Skip to content

Commit 613e50c

Browse files
committed
Rebuild of Django project
1 parent b94dd0b commit 613e50c

File tree

4 files changed

+46
-25
lines changed

4 files changed

+46
-25
lines changed

manage.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
23
import os
34
import sys
45

5-
if __name__ == "__main__":
6-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
7-
8-
from django.core.management import execute_from_command_line
96

7+
def main():
8+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
9+
try:
10+
from django.core.management import execute_from_command_line
11+
except ImportError as exc:
12+
raise ImportError(
13+
"Couldn't import Django. Are you sure it's installed and "
14+
"available on your PYTHONPATH environment variable? Did you "
15+
"forget to activate a virtual environment?"
16+
) from exc
1017
execute_from_command_line(sys.argv)
18+
19+
20+
if __name__ == '__main__':
21+
main()

project/settings.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
"""
22
Django settings for this project.
33
4-
Generated by 'django-admin startproject' using Django 1.11.6.
4+
Generated by 'django-admin startproject' using Django 2.2.12.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/1.11/topics/settings/
7+
https://docs.djangoproject.com/en/2.2/topics/settings/
88
99
For the full list of settings and their values, see
10-
https://docs.djangoproject.com/en/1.11/ref/settings/
10+
https://docs.djangoproject.com/en/2.2/ref/settings/
1111
"""
1212

1313
import os
@@ -17,7 +17,7 @@
1717

1818

1919
# Quick-start development settings - unsuitable for production
20-
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
20+
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
2121

2222
# SECURITY WARNING: keep the secret key used in production secret!
2323
# The SECRET_KEY is provided via an environment variable in OpenShift
@@ -76,11 +76,11 @@
7676
},
7777
]
7878

79-
WSGI_APPLICATION = 'wsgi.application'
79+
WSGI_APPLICATION = 'project.wsgi.application'
8080

8181

8282
# Database
83-
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
83+
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
8484

8585
from . import database
8686

@@ -90,7 +90,7 @@
9090

9191

9292
# Password validation
93-
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
93+
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
9494

9595
AUTH_PASSWORD_VALIDATORS = [
9696
{
@@ -109,7 +109,7 @@
109109

110110

111111
# Internationalization
112-
# https://docs.djangoproject.com/en/1.11/topics/i18n/
112+
# https://docs.djangoproject.com/en/2.2/topics/i18n/
113113

114114
LANGUAGE_CODE = 'en-us'
115115

@@ -123,7 +123,7 @@
123123

124124

125125
# Static files (CSS, JavaScript, Images)
126-
# https://docs.djangoproject.com/en/1.11/howto/static-files/
126+
# https://docs.djangoproject.com/en/2.2/howto/static-files/
127127

128128
STATIC_URL = '/static/'
129129
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

project/urls.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
1-
from django.conf import settings
2-
from django.conf.urls import include, url
1+
"""project URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/2.2/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: path('', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Import the include() function: from django.urls import include, path
14+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15+
"""
316
from django.contrib import admin
17+
from django.urls import path
418

519
from welcome.views import index, health
620

721
urlpatterns = [
8-
# Examples:
9-
# url(r'^$', 'project.views.home', name='home'),
10-
# url(r'^blog/', include('blog.urls')),
11-
12-
url(r'^$', index),
13-
url(r'^health$', health),
14-
url(r'^admin/', include(admin.site.urls)),
22+
path('', index, name='home'),
23+
path('health/', health),
24+
path('admin/', admin.site.urls),
1525
]
1626

1727
if settings.DEBUG:

wsgi.py renamed to project/wsgi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
"""
2-
WSGI config for project project.
2+
WSGI config for this project.
33
44
It exposes the WSGI callable as a module-level variable named ``application``.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
7+
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
88
"""
99

1010
import os
1111

1212
from django.core.wsgi import get_wsgi_application
1313

14-
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
1515

1616
application = get_wsgi_application()

0 commit comments

Comments
 (0)