Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated settings.py and url.py #263

Merged
merged 5 commits into from
Aug 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions HTTP_200/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import sys
import HTTP_200.config_keys as config_keys
import config as config
from django.core.urlresolvers import reverse_lazy
from django.urls import reverse_lazy

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
APPS_DIR = os.path.join(BASE_DIR, 'apps')
Expand All @@ -26,11 +26,9 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

TEMPLATE_DEBUG = DEBUG

ALLOWED_HOSTS = ["*"]

INTERNAL_IPS = '127.0.0.1'
INTERNAL_IPS = ['127.0.0.1', ]

APPEND_SLASH = True
# Application definition
Expand All @@ -51,30 +49,26 @@
'allauth.account',
'profiles',
'notices',
'autofixture',
'ckeditor',
'django_spaghetti',
'debug_toolbar',
'import_export',
'wifi',
'rest_framework_docs',
'rest_framework.authtoken',
'notifications',
)

MIDDLEWARE_CLASSES = (
MIDDLEWARE = (
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
# 'HTTP_200.middlewares.SetLastVisitMiddleware',
# 'django.middleware.security.SecurityMiddleware',
)

ROOT_URLCONF = 'HTTP_200.urls'
Expand All @@ -96,13 +90,12 @@
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.static',
'django.core.context_processors.request',
],
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader'
]
],
'debug': DEBUG
},
},
]
Expand All @@ -113,11 +106,11 @@
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
# }
# }

DATABASES = {
'default': {
Expand Down Expand Up @@ -262,6 +255,7 @@
}
]

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(TEMPLATE_DIR, 'media')

SPAGHETTI_SAUCE = {
Expand Down
38 changes: 19 additions & 19 deletions HTTP_200/urls.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
# django imports
from django.contrib import admin
from django.conf.urls import url, include, patterns

from django.conf.urls import url, include
from django.conf import settings
from django.conf.urls.static import static
# allauth imports
from allauth.account.views import login, logout

import debug_toolbar

# local file imports
from profiles.views import (Home,
FaqDisplayView,
about,
Contact,
BulkUser,
SingleUser)

SingleUser,
password_change)

import settings

admin.site.site_header = "JSS InfoConnect Admin Interface"

urlpatterns = [
# Web urls
url(r'^$', Home.as_view(), name="home"),
url(r'^notices/', include('notices.urls')),
url(r'^accounts/password/change/$', 'profiles.views.password_change', name='password_change'),
url(r'^accounts/password/change/$', password_change, name='password_change'),
url(r'^login/$', login, name="account_login"),
url(r'^logout/$', logout, name="account_logout"),
url(r'^accounts/', include('allauth.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/', admin.site.urls),
url(r'^user/', include('profiles.urls')),
url(r'^faq/$', FaqDisplayView.as_view(), name="faq"),
url(r'^about/$', about, name='about'),
Expand All @@ -38,19 +40,17 @@
url(r'wifi/', include('wifi.urls')),

# api urls
url(r'^api/profiles/', include("profiles.api.urls", namespace='profiles_api')),
url(r'^api/notices/', include("notices.api.urls", namespace='notices_api')),
url(r'^api/notifications/', include("notifications.api.urls", namespace='notifications_api')),

url(r'^api/profiles/', include("profiles.api.urls")),
url(r'^api/notices/', include("notices.api.urls")),
url(r'^api/notifications/', include("notifications.api.urls")),
]

# For development environment
debug_urlpatterns = [
*static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT),
url(r'^dbschema/', include('django_spaghetti.urls')),
url(r'^__debug__/', include(debug_toolbar.urls)),
]

if settings.DEBUG:
import debug_toolbar
urlpatterns += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT}),
url(r'^dbschema/', include('django_spaghetti.urls')),
url(r'^__debug__/', include(debug_toolbar.urls)),
url(r'^api/docs/', include('rest_framework_docs.urls')),
)
urlpatterns += debug_urlpatterns
2 changes: 1 addition & 1 deletion requirements/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ django-allauth==0.42.0
django-filter==2.3.0
PyJWT==1.7.1
django-braces==1.14.0
django-ckeditor==5.9.2
django-ckeditor==5.9.0
django-spaghetti-and-meatballs==0.2.2
django-debug-toolbar==2.2
coverage==5.2.1
Expand Down