Related
I'm new to Django, and even newer to using Railway. I've got a portfolio project that uses Django on the back end, and I was previously hosting on Heroku. I've attempted to move the deployment to Railway, and I've encountered a problem I can't figure out. Locally, I'm able to sign into the Django admin panel with the superuser credentials. When I attempt the same on the Railway deployment, I get a really long error that doesn't point to anything in my code. I've tried to research the error for a few days now, and I'm coming up blank.This is the error I see when I attempt to sign into the admin panel:
(Happy to add other files, but I don't know what is relevant?)
OperationalError at /admin/login/
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
Is the server running on that host and accepting TCP/IP connections?
Request Method: POST
Request URL: http://web-production-603f.up.railway.app/admin/login/?next=/admin/
Django Version: 4.0.6
Exception Type: OperationalError
Exception Value:
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
Is the server running on that host and accepting TCP/IP connections?
Exception Location: /opt/venv/lib/python3.9/site-packages/psycopg2/__init__.py, line 122, in connect
Python Executable: /opt/venv/bin/python
Python Version: 3.9.13
Python Path:
['/app',
'/opt/venv/bin',
'/nix/store/dcy4s05wgyznzcvghsm1sgbf7a0xrp8k-python3-3.9.13/lib/python39.zip',
'/nix/store/dcy4s05wgyznzcvghsm1sgbf7a0xrp8k-python3-3.9.13/lib/python3.9',
'/nix/store/dcy4s05wgyznzcvghsm1sgbf7a0xrp8k-python3-3.9.13/lib/python3.9/lib-dynload',
'/opt/venv/lib/python3.9/site-packages']
Server time: Fri, 16 Dec 2022 02:56:12 +0000
Traceback Switch to copy-and-paste view
/opt/venv/lib/python3.9/site-packages/django/db/backends/base/base.py, line 244, in ensure_connection
self.connect() …
Local vars
/opt/venv/lib/python3.9/site-packages/django/utils/asyncio.py, line 26, in inner
return func(*args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/backends/base/base.py, line 225, in connect
self.connection = self.get_new_connection(conn_params) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/utils/asyncio.py, line 26, in inner
return func(*args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/backends/postgresql/base.py, line 203, in get_new_connection
connection = Database.connect(**conn_params) …
Local vars
/opt/venv/lib/python3.9/site-packages/psycopg2/__init__.py, line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync) …
Local vars
The above exception (connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address Is the server running on that host and accepting TCP/IP connections? ) was the direct cause of the following exception:
/opt/venv/lib/python3.9/site-packages/django/core/handlers/exception.py, line 55, in inner
response = get_response(request) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/core/handlers/base.py, line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/utils/decorators.py, line 46, in _wrapper
return bound_method(*args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/views/decorators/cache.py, line 62, in _wrapped_view_func
response = view_func(request, *args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/contrib/admin/sites.py, line 440, in login
return LoginView.as_view(**defaults)(request) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/views/generic/base.py, line 84, in view
return self.dispatch(request, *args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/utils/decorators.py, line 46, in _wrapper
return bound_method(*args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/views/decorators/debug.py, line 92, in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/utils/decorators.py, line 46, in _wrapper
return bound_method(*args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/utils/decorators.py, line 133, in _wrapped_view
response = view_func(request, *args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/utils/decorators.py, line 46, in _wrapper
return bound_method(*args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/views/decorators/cache.py, line 62, in _wrapped_view_func
response = view_func(request, *args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/contrib/auth/views.py, line 67, in dispatch
return super().dispatch(request, *args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/views/generic/base.py, line 119, in dispatch
return handler(request, *args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/views/generic/edit.py, line 152, in post
if form.is_valid(): …
Local vars
/opt/venv/lib/python3.9/site-packages/django/forms/forms.py, line 205, in is_valid
return self.is_bound and not self.errors …
Local vars
/opt/venv/lib/python3.9/site-packages/django/forms/forms.py, line 200, in errors
self.full_clean() …
Local vars
/opt/venv/lib/python3.9/site-packages/django/forms/forms.py, line 434, in full_clean
self._clean_form() …
Local vars
/opt/venv/lib/python3.9/site-packages/django/forms/forms.py, line 455, in _clean_form
cleaned_data = self.clean() …
Local vars
/opt/venv/lib/python3.9/site-packages/django/contrib/auth/forms.py, line 217, in clean
self.user_cache = authenticate( …
Local vars
/opt/venv/lib/python3.9/site-packages/django/views/decorators/debug.py, line 42, in sensitive_variables_wrapper
return func(*func_args, **func_kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/contrib/auth/__init__.py, line 77, in authenticate
user = backend.authenticate(request, **credentials) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/contrib/auth/backends.py, line 42, in authenticate
user = UserModel._default_manager.get_by_natural_key(username) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/contrib/auth/base_user.py, line 46, in get_by_natural_key
return self.get(**{self.model.USERNAME_FIELD: username}) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/models/manager.py, line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/models/query.py, line 492, in get
num = len(clone) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/models/query.py, line 302, in __len__
self._fetch_all() …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/models/query.py, line 1507, in _fetch_all
self._result_cache = list(self._iterable_class(self)) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/models/query.py, line 57, in __iter__
results = compiler.execute_sql( …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/models/sql/compiler.py, line 1359, in execute_sql
cursor = self.connection.cursor() …
Local vars
/opt/venv/lib/python3.9/site-packages/django/utils/asyncio.py, line 26, in inner
return func(*args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/backends/base/base.py, line 284, in cursor
return self._cursor() …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/backends/base/base.py, line 260, in _cursor
self.ensure_connection() …
Local vars
/opt/venv/lib/python3.9/site-packages/django/utils/asyncio.py, line 26, in inner
return func(*args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/backends/base/base.py, line 244, in ensure_connection
self.connect() …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/utils.py, line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/backends/base/base.py, line 244, in ensure_connection
self.connect() …
Local vars
/opt/venv/lib/python3.9/site-packages/django/utils/asyncio.py, line 26, in inner
return func(*args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/backends/base/base.py, line 225, in connect
self.connection = self.get_new_connection(conn_params) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/utils/asyncio.py, line 26, in inner
return func(*args, **kwargs) …
Local vars
/opt/venv/lib/python3.9/site-packages/django/db/backends/postgresql/base.py, line 203, in get_new_connection
connection = Database.connect(**conn_params) …
Local vars
/opt/venv/lib/python3.9/site-packages/psycopg2/__init__.py, line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync) …
Local vars
Request information
USER
AnonymousUser
GET
Variable Value
next
'/admin/'
POST
Variable Value
csrfmiddlewaretoken
'gnerlsZGWNRbSjJPCOiERFCaGSjEbkwjpgbMjByrlGPY83WUvXqntjX4fVFbqDBm'
username
'ANsuperuser'
password
'theAlumniNetwork'
next
'/admin/'
FILES
No FILES data
COOKIES
Variable Value
csrftoken
'yuSiUt6a0Z8ycJvqpgu6A376k5nrSYJ1HnPDSCFVpS6lstIvipCPcHs0T8JY7hO4'
META
Variable Value
CONTENT_LENGTH
'148'
CONTENT_TYPE
'application/x-www-form-urlencoded'
CSRF_COOKIE
'yuSiUt6a0Z8ycJvqpgu6A376k5nrSYJ1HnPDSCFVpS6lstIvipCPcHs0T8JY7hO4'
HTTP_ACCEPT
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
HTTP_ACCEPT_ENCODING
'gzip, deflate, br'
HTTP_ACCEPT_LANGUAGE
'en-US,en;q=0.9'
HTTP_CACHE_CONTROL
'max-age=0'
HTTP_COOKIE
'csrftoken=yuSiUt6a0Z8ycJvqpgu6A376k5nrSYJ1HnPDSCFVpS6lstIvipCPcHs0T8JY7hO4'
HTTP_DNT
'1'
HTTP_HOST
'web-production-603f.up.railway.app'
HTTP_ORIGIN
'https://web-production-603f.up.railway.app'
HTTP_REFERER
'https://web-production-603f.up.railway.app/admin/login/?next=/admin/'
HTTP_SEC_CH_UA
'"Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"'
HTTP_SEC_CH_UA_MOBILE
'?0'
HTTP_SEC_CH_UA_PLATFORM
'"macOS"'
HTTP_SEC_FETCH_DEST
'document'
HTTP_SEC_FETCH_MODE
'navigate'
HTTP_SEC_FETCH_SITE
'same-origin'
HTTP_SEC_FETCH_USER
'?1'
HTTP_UPGRADE_INSECURE_REQUESTS
'1'
HTTP_USER_AGENT
('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, '
'like Gecko) Chrome/106.0.0.0 Safari/537.36')
HTTP_X_ENVOY_EXTERNAL_ADDRESS
'73.123.42.143'
HTTP_X_FORWARDED_FOR
'73.123.42.143'
HTTP_X_FORWARDED_PROTO
'https'
HTTP_X_REQUEST_ID
'4df69a6b-34ab-4a3e-8b1f-f3832c01f964'
PATH_INFO
'/admin/login/'
QUERY_STRING
'next=/admin/'
RAW_URI
'/admin/login/?next=/admin/'
REMOTE_ADDR
'10.10.10.15'
REMOTE_PORT
'58398'
REQUEST_METHOD
'POST'
SCRIPT_NAME
''
SERVER_NAME
'0.0.0.0'
SERVER_PORT
'5878'
SERVER_PROTOCOL
'HTTP/1.1'
SERVER_SOFTWARE
'gunicorn/20.1.0'
gunicorn.socket
<socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('172.17.0.37', 5878), raddr=('10.10.10.15', 58398)>
wsgi.errors
<gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f5b62ff7280>
wsgi.file_wrapper
<class 'gunicorn.http.wsgi.FileWrapper'>
wsgi.input
<gunicorn.http.body.Body object at 0x7f5b62ff7190>
wsgi.input_terminated
True
wsgi.multiprocess
False
wsgi.multithread
False
wsgi.run_once
False
wsgi.url_scheme
'http'
wsgi.version
(1, 0)
Settings
Using settings module alumni_network_proj.settings
Setting Value
ABSOLUTE_URL_OVERRIDES
{}
ADMINS
[]
ALLOWED_HOSTS
['*']
APPEND_SLASH
True
AUTHENTICATION_BACKENDS
['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS
'********************'
AUTH_USER_MODEL
'auth.User'
BASE_DIR
PosixPath('/app')
CACHES
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS
'default'
CACHE_MIDDLEWARE_KEY_PREFIX
'********************'
CACHE_MIDDLEWARE_SECONDS
600
CORS_ALLOW_ALL_ORIGINS
True
CSRF_COOKIE_AGE
31449600
CSRF_COOKIE_DOMAIN
None
CSRF_COOKIE_HTTPONLY
False
CSRF_COOKIE_NAME
'csrftoken'
CSRF_COOKIE_PATH
'/'
CSRF_COOKIE_SAMESITE
'Lax'
CSRF_COOKIE_SECURE
False
CSRF_FAILURE_VIEW
'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME
'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS
['https://web-production-603f.up.railway.app']
CSRF_USE_SESSIONS
False
DATABASES
{'default': {'ATOMIC_REQUESTS': False,
'AUTOCOMMIT': True,
'CONN_MAX_AGE': 600,
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': 'localhost',
'NAME': 'alumni_network',
'OPTIONS': {},
'PASSWORD': '********************',
'PORT': 5432,
'TEST': {'CHARSET': None,
'COLLATION': None,
'MIGRATE': True,
'MIRROR': None,
'NAME': None},
'TIME_ZONE': None,
'USER': 'alumni_network_user'}}
DATABASE_ROUTERS
[]
DATA_UPLOAD_MAX_MEMORY_SIZE
2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS
1000
DATETIME_FORMAT
'N j, Y, P'
DATETIME_INPUT_FORMATS
['%Y-%m-%d %H:%M:%S',
'%Y-%m-%d %H:%M:%S.%f',
'%Y-%m-%d %H:%M',
'%m/%d/%Y %H:%M:%S',
'%m/%d/%Y %H:%M:%S.%f',
'%m/%d/%Y %H:%M',
'%m/%d/%y %H:%M:%S',
'%m/%d/%y %H:%M:%S.%f',
'%m/%d/%y %H:%M']
DATE_FORMAT
'N j, Y'
DATE_INPUT_FORMATS
['%Y-%m-%d',
'%m/%d/%Y',
'%m/%d/%y',
'%b %d %Y',
'%b %d, %Y',
'%d %b %Y',
'%d %b, %Y',
'%B %d %Y',
'%B %d, %Y',
'%d %B %Y',
'%d %B, %Y']
DEBUG
True
DEBUG_PROPAGATE_EXCEPTIONS
False
DECIMAL_SEPARATOR
'.'
DEFAULT_AUTO_FIELD
'django.db.models.BigAutoField'
DEFAULT_CHARSET
'utf-8'
DEFAULT_EXCEPTION_REPORTER
'django.views.debug.ExceptionReporter'
DEFAULT_EXCEPTION_REPORTER_FILTER
'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE
'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL
'webmaster#localhost'
DEFAULT_INDEX_TABLESPACE
''
DEFAULT_TABLESPACE
''
DISALLOWED_USER_AGENTS
[]
EMAIL_BACKEND
'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST
'localhost'
EMAIL_HOST_PASSWORD
'********************'
EMAIL_HOST_USER
''
EMAIL_PORT
25
EMAIL_SSL_CERTFILE
None
EMAIL_SSL_KEYFILE
'********************'
EMAIL_SUBJECT_PREFIX
'[Django] '
EMAIL_TIMEOUT
None
EMAIL_USE_LOCALTIME
False
EMAIL_USE_SSL
False
EMAIL_USE_TLS
False
FILE_UPLOAD_DIRECTORY_PERMISSIONS
None
FILE_UPLOAD_HANDLERS
['django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE
2621440
FILE_UPLOAD_PERMISSIONS
420
FILE_UPLOAD_TEMP_DIR
None
FIRST_DAY_OF_WEEK
0
FIXTURE_DIRS
[]
FORCE_SCRIPT_NAME
None
FORMAT_MODULE_PATH
None
FORM_RENDERER
'django.forms.renderers.DjangoTemplates'
IGNORABLE_404_URLS
[]
INSTALLED_APPS
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'alumni_network_app',
'corsheaders',
'rest_framework',
'rest_framework_simplejwt.token_blacklist']
INTERNAL_IPS
[]
LANGUAGES
[('af', 'Afrikaans'),
('ar', 'Arabic'),
('ar-dz', 'Algerian Arabic'),
('ast', 'Asturian'),
('az', 'Azerbaijani'),
('bg', 'Bulgarian'),
('be', 'Belarusian'),
('bn', 'Bengali'),
('br', 'Breton'),
('bs', 'Bosnian'),
('ca', 'Catalan'),
('cs', 'Czech'),
('cy', 'Welsh'),
('da', 'Danish'),
('de', 'German'),
('dsb', 'Lower Sorbian'),
('el', 'Greek'),
('en', 'English'),
('en-au', 'Australian English'),
('en-gb', 'British English'),
('eo', 'Esperanto'),
('es', 'Spanish'),
('es-ar', 'Argentinian Spanish'),
('es-co', 'Colombian Spanish'),
('es-mx', 'Mexican Spanish'),
('es-ni', 'Nicaraguan Spanish'),
('es-ve', 'Venezuelan Spanish'),
('et', 'Estonian'),
('eu', 'Basque'),
('fa', 'Persian'),
('fi', 'Finnish'),
('fr', 'French'),
('fy', 'Frisian'),
('ga', 'Irish'),
('gd', 'Scottish Gaelic'),
('gl', 'Galician'),
('he', 'Hebrew'),
('hi', 'Hindi'),
('hr', 'Croatian'),
('hsb', 'Upper Sorbian'),
('hu', 'Hungarian'),
('hy', 'Armenian'),
('ia', 'Interlingua'),
('id', 'Indonesian'),
('ig', 'Igbo'),
('io', 'Ido'),
('is', 'Icelandic'),
('it', 'Italian'),
('ja', 'Japanese'),
('ka', 'Georgian'),
('kab', 'Kabyle'),
('kk', 'Kazakh'),
('km', 'Khmer'),
('kn', 'Kannada'),
('ko', 'Korean'),
('ky', 'Kyrgyz'),
('lb', 'Luxembourgish'),
('lt', 'Lithuanian'),
('lv', 'Latvian'),
('mk', 'Macedonian'),
('ml', 'Malayalam'),
('mn', 'Mongolian'),
('mr', 'Marathi'),
('ms', 'Malay'),
('my', 'Burmese'),
('nb', 'Norwegian Bokmål'),
('ne', 'Nepali'),
('nl', 'Dutch'),
('nn', 'Norwegian Nynorsk'),
('os', 'Ossetic'),
('pa', 'Punjabi'),
('pl', 'Polish'),
('pt', 'Portuguese'),
('pt-br', 'Brazilian Portuguese'),
('ro', 'Romanian'),
('ru', 'Russian'),
('sk', 'Slovak'),
('sl', 'Slovenian'),
('sq', 'Albanian'),
('sr', 'Serbian'),
('sr-latn', 'Serbian Latin'),
('sv', 'Swedish'),
('sw', 'Swahili'),
('ta', 'Tamil'),
('te', 'Telugu'),
('tg', 'Tajik'),
('th', 'Thai'),
('tk', 'Turkmen'),
('tr', 'Turkish'),
('tt', 'Tatar'),
('udm', 'Udmurt'),
('uk', 'Ukrainian'),
('ur', 'Urdu'),
('uz', 'Uzbek'),
('vi', 'Vietnamese'),
('zh-hans', 'Simplified Chinese'),
('zh-hant', 'Traditional Chinese')]
LANGUAGES_BIDI
['he', 'ar', 'ar-dz', 'fa', 'ur']
LANGUAGE_CODE
'en-us'
LANGUAGE_COOKIE_AGE
None
LANGUAGE_COOKIE_DOMAIN
None
LANGUAGE_COOKIE_HTTPONLY
False
LANGUAGE_COOKIE_NAME
'django_language'
LANGUAGE_COOKIE_PATH
'/'
LANGUAGE_COOKIE_SAMESITE
None
LANGUAGE_COOKIE_SECURE
False
LOCALE_PATHS
[]
LOGGING
{}
LOGGING_CONFIG
'logging.config.dictConfig'
LOGIN_REDIRECT_URL
'/accounts/profile/'
LOGIN_URL
'/accounts/login/'
LOGOUT_REDIRECT_URL
None
MANAGERS
[]
MEDIA_ROOT
''
MEDIA_URL
'/'
MESSAGE_STORAGE
'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE
['django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
MIGRATION_MODULES
{}
MONTH_DAY_FORMAT
'F j'
NUMBER_GROUPING
0
PASSWORD_HASHERS
'********************'
PASSWORD_RESET_TIMEOUT
'********************'
PREPEND_WWW
False
REST_FRAMEWORK
{'DEFAULT_AUTHENTICATION_CLASSES': ('rest_framework_simplejwt.authentication.JWTAuthentication',)}
ROOT_URLCONF
'alumni_network_proj.urls'
SECRET_KEY
'********************'
SECURE_CONTENT_TYPE_NOSNIFF
True
SECURE_CROSS_ORIGIN_OPENER_POLICY
'same-origin'
SECURE_HSTS_INCLUDE_SUBDOMAINS
False
SECURE_HSTS_PRELOAD
False
SECURE_HSTS_SECONDS
0
SECURE_PROXY_SSL_HEADER
None
SECURE_REDIRECT_EXEMPT
[]
SECURE_REFERRER_POLICY
'same-origin'
SECURE_SSL_HOST
None
SECURE_SSL_REDIRECT
False
SERVER_EMAIL
'root#localhost'
SESSION_CACHE_ALIAS
'default'
SESSION_COOKIE_AGE
1209600
SESSION_COOKIE_DOMAIN
None
SESSION_COOKIE_HTTPONLY
True
SESSION_COOKIE_NAME
'sessionid'
SESSION_COOKIE_PATH
'/'
SESSION_COOKIE_SAMESITE
'Lax'
SESSION_COOKIE_SECURE
False
SESSION_ENGINE
'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE
False
SESSION_FILE_PATH
None
SESSION_SAVE_EVERY_REQUEST
False
SESSION_SERIALIZER
'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE
'alumni_network_proj.settings'
SHORT_DATETIME_FORMAT
'm/d/Y P'
SHORT_DATE_FORMAT
'm/d/Y'
SIGNING_BACKEND
'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS
[]
SIMPLE_JWT
{'ACCESS_TOKEN_LIFETIME': '********************',
'ALGORITHM': 'HS256',
'AUDIENCE': None,
'AUTH_HEADER_NAME': 'HTTP_AUTHORIZATION',
'AUTH_HEADER_TYPES': ('Bearer',),
'AUTH_TOKEN_CLASSES': '********************',
'BLACKLIST_AFTER_ROTATION': True,
'ISSUER': None,
'JTI_CLAIM': 'jti',
'JWK_URL': None,
'LEEWAY': 0,
'REFRESH_TOKEN_LIFETIME': '********************',
'ROTATE_REFRESH_TOKENS': '********************',
'SLIDING_TOKEN_LIFETIME': '********************',
'SLIDING_TOKEN_REFRESH_EXP_CLAIM': '********************',
'SLIDING_TOKEN_REFRESH_LIFETIME': '********************',
'TOKEN_TYPE_CLAIM': '********************',
'TOKEN_USER_CLASS': '********************',
'UPDATE_LAST_LOGIN': False,
'USER_AUTHENTICATION_RULE': 'rest_framework_simplejwt.authentication.default_user_authentication_rule',
'USER_ID_CLAIM': 'user_id',
'USER_ID_FIELD': 'id',
'VERIFYING_KEY': '********************'}
STATICFILES_DIRS
['/app/static']
STATICFILES_FINDERS
['django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE
'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT
'/app/staticfiles'
STATIC_URL
'/static/'
TEMPLATES
[{'APP_DIRS': True,
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'OPTIONS': {'context_processors': ['django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages']}}]
TEST_NON_SERIALIZED_APPS
[]
TEST_RUNNER
'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR
','
TIME_FORMAT
'P'
TIME_INPUT_FORMATS
['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE
'UTC'
USE_DEPRECATED_PYTZ
False
USE_I18N
True
USE_L10N
True
USE_THOUSAND_SEPARATOR
False
USE_TZ
True
USE_X_FORWARDED_HOST
False
USE_X_FORWARDED_PORT
False
WSGI_APPLICATION
'alumni_network_proj.wsgi.application'
X_FRAME_OPTIONS
'DENY'
YEAR_MONTH_FORMAT
'F Y'
I've tried making changes to environment variables, also tried railway run python3 manage.py createsuperuser but it will tell me the superuser already exists. I just don't know where the error is coming from so I don't know where to look?
the error says that there is no connection to the database. It is working locally because you have installed postgresql locally. Have you installed a postgres on railway and what is the host of the database ? Django settings needs to know the host name of the database. Btw try to create different environment settings (local => dev and prod).
I am trying to deploy my Django project using Ubuntu and apache webserver. When I transferred my project to the Ubuntu web server and tested it in development, everything went fine. However when changed to production, I experienced file not found problem and I suspect this problem is related to my setings.py, but I am unable to troubleshoot it further. The error I see in production when accessing my site is:
Environment:
Request Method: GET
Request URL: http://139.162.163.35/
Django Version: 3.1.3
Python Version: 3.8.5
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/home/jianwu/HD_website/website/env/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/home/jianwu/HD_website/website/env/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/jianwu/HD_website/website/env/lib/python3.8/site-packages/django/views/generic/base.py", line 63, in view
self = cls(**initkwargs)
File "/home/jianwu/HD_website/website/index/views.py", line 57, in __init__
self.ContextObject.importTextFile('static/mainAboutUs.txt')
File "/home/jianwu/HD_website/website/index/views.py", line 50, in importTextFile
with open(filePath,'r') as fid:
Exception Type: FileNotFoundError at /
Exception Value: [Errno 2] No such file or directory: 'static/mainAboutUs.txt'
In my Meta I have
CONTEXT_DOCUMENT_ROOT
'/var/www/html'
CONTEXT_PREFIX
''
CSRF_COOKIE
'jF3vdEgpyhbKxavRw3pEWzRdIjc4lvw0MsV4lpBLdYXPqcGcIVyH02kEuBeGSXlh'
DOCUMENT_ROOT
'/var/www/html'
GATEWAY_INTERFACE
'CGI/1.1'
HTTP_ACCEPT
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
HTTP_ACCEPT_ENCODING
'gzip, deflate'
HTTP_ACCEPT_LANGUAGE
'da-DK,da;q=0.9,en-US;q=0.8,en;q=0.7,bg;q=0.6,zh-CN;q=0.5,zh;q=0.4'
HTTP_CONNECTION
'keep-alive'
HTTP_COOKIE
'csrftoken=jF3vdEgpyhbKxavRw3pEWzRdIjc4lvw0MsV4lpBLdYXPqcGcIVyH02kEuBeGSXlh'
HTTP_HOST
'139.162.163.35'
HTTP_PURPOSE
'prefetch'
HTTP_UPGRADE_INSECURE_REQUESTS
'1'
HTTP_USER_AGENT
('Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, '
'like Gecko) Chrome/88.0.4324.192 Safari/537.36')
PATH_INFO
'/'
PATH_TRANSLATED
'/home/jianwu/HD_website/website/website/wsgi.py/'
QUERY_STRING
''
REMOTE_ADDR
'94.147.65.45'
REMOTE_PORT
'58717'
REQUEST_METHOD
'GET'
REQUEST_SCHEME
'http'
REQUEST_URI
'/'
SCRIPT_FILENAME
'/home/jianwu/HD_website/website/website/wsgi.py'
SCRIPT_NAME
''
SERVER_ADDR
'139.162.163.35'
SERVER_ADMIN
'webmaster#localhost'
SERVER_NAME
'139.162.163.35'
SERVER_PORT
'80'
SERVER_PROTOCOL
'HTTP/1.1'
SERVER_SIGNATURE
'********************'
SERVER_SOFTWARE
'Apache/2.4.41 (Ubuntu)'
apache.version
(2, 4, 41)
mod_wsgi.application_group
'139.162.163.35|'
mod_wsgi.callable_object
'application'
mod_wsgi.daemon_connects
'1'
mod_wsgi.daemon_restarts
'0'
mod_wsgi.daemon_start
'1615618126945298'
mod_wsgi.enable_sendfile
'0'
mod_wsgi.handler_script
''
mod_wsgi.ignore_activity
'0'
mod_wsgi.listener_host
''
mod_wsgi.listener_port
'80'
mod_wsgi.path_info
'/'
mod_wsgi.process_group
'django_app'
mod_wsgi.queue_start
'1615618126945099'
mod_wsgi.request_handler
'wsgi-script'
mod_wsgi.request_id
'Z5qMaD13cW8'
mod_wsgi.request_start
'1615618126944871'
mod_wsgi.script_name
''
mod_wsgi.script_reloading
'1'
mod_wsgi.script_start
'1615618126945462'
mod_wsgi.thread_id
2
mod_wsgi.thread_requests
13
mod_wsgi.total_requests
27
mod_wsgi.version
(4, 6, 8)
wsgi.errors
<_io.TextIOWrapper name='<wsgi.errors>' encoding='utf-8'>
wsgi.file_wrapper
<class 'mod_wsgi.FileWrapper'>
wsgi.input
<mod_wsgi.Input object at 0x7f38645595e0>
wsgi.input_terminated
True
wsgi.multiprocess
False
wsgi.multithread
True
wsgi.run_once
False
wsgi.url_scheme
'http'
wsgi.version
(1, 0)
In settings in the webrowser I have
ABSOLUTE_URL_OVERRIDES
{}
ADMINS
[]
ALLOWED_HOSTS
['139.162.163.35']
APPEND_SLASH
True
AUTHENTICATION_BACKENDS
['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS
'********************'
AUTH_USER_MODEL
'auth.User'
BASE_DIR
PosixPath('/home/jianwu/HD_website/website')
CACHES
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS
'default'
CACHE_MIDDLEWARE_KEY_PREFIX
'********************'
CACHE_MIDDLEWARE_SECONDS
600
CSRF_COOKIE_AGE
31449600
CSRF_COOKIE_DOMAIN
None
CSRF_COOKIE_HTTPONLY
False
CSRF_COOKIE_NAME
'csrftoken'
CSRF_COOKIE_PATH
'/'
CSRF_COOKIE_SAMESITE
'Lax'
CSRF_COOKIE_SECURE
False
CSRF_FAILURE_VIEW
'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME
'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS
[]
CSRF_USE_SESSIONS
False
DATABASES
{'default': {'ATOMIC_REQUESTS': False,
'AUTOCOMMIT': True,
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.sqlite3',
'HOST': '',
'NAME': PosixPath('/home/jianwu/HD_website/website/db.sqlite3'),
'OPTIONS': {},
'PASSWORD': '********************',
'PORT': '',
'TEST': {'CHARSET': None,
'COLLATION': None,
'MIGRATE': True,
'MIRROR': None,
'NAME': None},
'TIME_ZONE': None,
'USER': ''}}
DATABASE_ROUTERS
[]
DATA_UPLOAD_MAX_MEMORY_SIZE
2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS
1000
DATETIME_FORMAT
'N j, Y, P'
DATETIME_INPUT_FORMATS
['%Y-%m-%d %H:%M:%S',
'%Y-%m-%d %H:%M:%S.%f',
'%Y-%m-%d %H:%M',
'%m/%d/%Y %H:%M:%S',
'%m/%d/%Y %H:%M:%S.%f',
'%m/%d/%Y %H:%M',
'%m/%d/%y %H:%M:%S',
'%m/%d/%y %H:%M:%S.%f',
'%m/%d/%y %H:%M']
DATE_FORMAT
'N j, Y'
DATE_INPUT_FORMATS
['%Y-%m-%d',
'%m/%d/%Y',
'%m/%d/%y',
'%b %d %Y',
'%b %d, %Y',
'%d %b %Y',
'%d %b, %Y',
'%B %d %Y',
'%B %d, %Y',
'%d %B %Y',
'%d %B, %Y']
DEBUG
True
DEBUG_PROPAGATE_EXCEPTIONS
False
DECIMAL_SEPARATOR
'.'
DEFAULT_CHARSET
'utf-8'
DEFAULT_EXCEPTION_REPORTER
'django.views.debug.ExceptionReporter'
DEFAULT_EXCEPTION_REPORTER_FILTER
'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE
'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL
'webmaster#localhost'
DEFAULT_HASHING_ALGORITHM
'sha256'
DEFAULT_INDEX_TABLESPACE
''
DEFAULT_TABLESPACE
''
DISALLOWED_USER_AGENTS
[]
EMAIL_BACKEND
'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST
'localhost'
EMAIL_HOST_PASSWORD
'********************'
EMAIL_HOST_USER
''
EMAIL_PORT
25
EMAIL_SSL_CERTFILE
None
EMAIL_SSL_KEYFILE
'********************'
EMAIL_SUBJECT_PREFIX
'[Django] '
EMAIL_TIMEOUT
None
EMAIL_USE_LOCALTIME
False
EMAIL_USE_SSL
False
EMAIL_USE_TLS
False
FILE_UPLOAD_DIRECTORY_PERMISSIONS
None
FILE_UPLOAD_HANDLERS
['django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE
2621440
FILE_UPLOAD_PERMISSIONS
420
FILE_UPLOAD_TEMP_DIR
None
FIRST_DAY_OF_WEEK
0
FIXTURE_DIRS
[]
FORCE_SCRIPT_NAME
None
FORMAT_MODULE_PATH
None
FORM_RENDERER
'django.forms.renderers.DjangoTemplates'
IGNORABLE_404_URLS
[]
INSTALLED_APPS
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
INTERNAL_IPS
[]
LANGUAGES
[('af', 'Afrikaans'),
('ar', 'Arabic'),
('ar-dz', 'Algerian Arabic'),
('ast', 'Asturian'),
('az', 'Azerbaijani'),
('bg', 'Bulgarian'),
('be', 'Belarusian'),
('bn', 'Bengali'),
('br', 'Breton'),
('bs', 'Bosnian'),
('ca', 'Catalan'),
('cs', 'Czech'),
('cy', 'Welsh'),
('da', 'Danish'),
('de', 'German'),
('dsb', 'Lower Sorbian'),
('el', 'Greek'),
('en', 'English'),
('en-au', 'Australian English'),
('en-gb', 'British English'),
('eo', 'Esperanto'),
('es', 'Spanish'),
('es-ar', 'Argentinian Spanish'),
('es-co', 'Colombian Spanish'),
('es-mx', 'Mexican Spanish'),
('es-ni', 'Nicaraguan Spanish'),
('es-ve', 'Venezuelan Spanish'),
('et', 'Estonian'),
('eu', 'Basque'),
('fa', 'Persian'),
('fi', 'Finnish'),
('fr', 'French'),
('fy', 'Frisian'),
('ga', 'Irish'),
('gd', 'Scottish Gaelic'),
('gl', 'Galician'),
('he', 'Hebrew'),
('hi', 'Hindi'),
('hr', 'Croatian'),
('hsb', 'Upper Sorbian'),
('hu', 'Hungarian'),
('hy', 'Armenian'),
('ia', 'Interlingua'),
('id', 'Indonesian'),
('ig', 'Igbo'),
('io', 'Ido'),
('is', 'Icelandic'),
('it', 'Italian'),
('ja', 'Japanese'),
('ka', 'Georgian'),
('kab', 'Kabyle'),
('kk', 'Kazakh'),
('km', 'Khmer'),
('kn', 'Kannada'),
('ko', 'Korean'),
('ky', 'Kyrgyz'),
('lb', 'Luxembourgish'),
('lt', 'Lithuanian'),
('lv', 'Latvian'),
('mk', 'Macedonian'),
('ml', 'Malayalam'),
('mn', 'Mongolian'),
('mr', 'Marathi'),
('my', 'Burmese'),
('nb', 'Norwegian Bokmål'),
('ne', 'Nepali'),
('nl', 'Dutch'),
('nn', 'Norwegian Nynorsk'),
('os', 'Ossetic'),
('pa', 'Punjabi'),
('pl', 'Polish'),
('pt', 'Portuguese'),
('pt-br', 'Brazilian Portuguese'),
('ro', 'Romanian'),
('ru', 'Russian'),
('sk', 'Slovak'),
('sl', 'Slovenian'),
('sq', 'Albanian'),
('sr', 'Serbian'),
('sr-latn', 'Serbian Latin'),
('sv', 'Swedish'),
('sw', 'Swahili'),
('ta', 'Tamil'),
('te', 'Telugu'),
('tg', 'Tajik'),
('th', 'Thai'),
('tk', 'Turkmen'),
('tr', 'Turkish'),
('tt', 'Tatar'),
('udm', 'Udmurt'),
('uk', 'Ukrainian'),
('ur', 'Urdu'),
('uz', 'Uzbek'),
('vi', 'Vietnamese'),
('zh-hans', 'Simplified Chinese'),
('zh-hant', 'Traditional Chinese')]
LANGUAGES_BIDI
['he', 'ar', 'ar-dz', 'fa', 'ur']
LANGUAGE_CODE
'en-us'
LANGUAGE_COOKIE_AGE
None
LANGUAGE_COOKIE_DOMAIN
None
LANGUAGE_COOKIE_HTTPONLY
False
LANGUAGE_COOKIE_NAME
'django_language'
LANGUAGE_COOKIE_PATH
'/'
LANGUAGE_COOKIE_SAMESITE
None
LANGUAGE_COOKIE_SECURE
False
LOCALE_PATHS
[]
LOGGING
{}
LOGGING_CONFIG
'logging.config.dictConfig'
LOGIN_REDIRECT_URL
'/accounts/profile/'
LOGIN_URL
'/accounts/login/'
LOGOUT_REDIRECT_URL
None
MANAGERS
[]
MEDIA_ROOT
''
MEDIA_URL
'/'
MESSAGE_STORAGE
'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
MIGRATION_MODULES
{}
MONTH_DAY_FORMAT
'F j'
NUMBER_GROUPING
0
PASSWORD_HASHERS
'********************'
PASSWORD_RESET_TIMEOUT
'********************'
PASSWORD_RESET_TIMEOUT_DAYS
'********************'
PREPEND_WWW
False
ROOT_URLCONF
'website.urls'
SECRET_KEY
'********************'
SECURE_BROWSER_XSS_FILTER
False
SECURE_CONTENT_TYPE_NOSNIFF
True
SECURE_HSTS_INCLUDE_SUBDOMAINS
False
SECURE_HSTS_PRELOAD
False
SECURE_HSTS_SECONDS
0
SECURE_PROXY_SSL_HEADER
None
SECURE_REDIRECT_EXEMPT
[]
SECURE_REFERRER_POLICY
'same-origin'
SECURE_SSL_HOST
None
SECURE_SSL_REDIRECT
False
SERVER_EMAIL
'root#localhost'
SESSION_CACHE_ALIAS
'default'
SESSION_COOKIE_AGE
1209600
SESSION_COOKIE_DOMAIN
None
SESSION_COOKIE_HTTPONLY
True
SESSION_COOKIE_NAME
'sessionid'
SESSION_COOKIE_PATH
'/'
SESSION_COOKIE_SAMESITE
'Lax'
SESSION_COOKIE_SECURE
False
SESSION_ENGINE
'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE
False
SESSION_FILE_PATH
None
SESSION_SAVE_EVERY_REQUEST
False
SESSION_SERIALIZER
'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE
'website.settings'
SHORT_DATETIME_FORMAT
'm/d/Y P'
SHORT_DATE_FORMAT
'm/d/Y'
SIGNING_BACKEND
'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS
[]
STATICFILES_DIRS
('/home/jianwu/HD_website/website/static',)
STATICFILES_FINDERS
['django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE
'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT
'/home/jianwu/HD_website/website/productionStatic'
STATIC_URL
'/static/'
TEMPLATES
[{'APP_DIRS': True,
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'OPTIONS': {'context_processors': ['django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages']}}]
TEST_NON_SERIALIZED_APPS
[]
TEST_RUNNER
'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR
','
TIME_FORMAT
'P'
TIME_INPUT_FORMATS
['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE
'UTC'
USE_I18N
True
USE_L10N
True
USE_THOUSAND_SEPARATOR
False
USE_TZ
True
USE_X_FORWARDED_HOST
False
USE_X_FORWARDED_PORT
False
WSGI_APPLICATION
'website.wsgi.application'
X_FRAME_OPTIONS
'DENY'
YEAR_MONTH_FORMAT
'F Y'
My settings.py is as below and I have pointed my STATIC_ROOT to productionStatic folder. This is the folder where collectstatic has transferred the static files from my static folder to productionStatic. I am not sure why this is necessary as I can only read from Django's documentation that the files should be copied over in production.
"""
Django settings for website project.
Generated by 'django-admin startproject' using Django 3.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
import os
import json
#with open('/etc/config.json') as fileId:
# config = json.load(fileId)
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'xxxxxxxxxxxxxxxxxxx'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['139.162.163.35']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'website.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'website.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'productionStatic')
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)
In my views.py a snippet of where I am importing the txt file in question is in static/aboutUsNytorv.txt. I have tried to change it to productionStatic/aboutUsNytorv.txt but it keeps saying that it cannot find the file.
from django.shortcuts import redirect, render
from django.contrib import messages
from django.views import View
from .forms import contactForm
from .forms import newsLetterForm
from website.Modules.emailMessage import sendEmail
from website.Modules.registerEmailSubscription import registerEmail
from website.Modules.recaptchaValidate import Validate
# Create your views here.
class ContextBuilder:
def __init__(self):
self.context = {'imagePath' : None,
'navbarLogoPath' : None,
'links' : None,
'menuImgPath' : None,
'aboutUsImagePath' : None,
'aboutUsText' : None,
'dayRange1' : None,
'timeRange1' : None,
'form' : None,
'emailSignUpForm' : None,
'shopTitle' : None,
'addressStreet' : None,
'addressPhone' : None,
'addressEmail' : 'kontakt#dimsum.dk',
'addressCVR' : 'CVR: 38908901',
'instagramLink' : None,
'youtubeLink' : None,
'facebookLink' : None}
def Set_headerCoverImageLinks(self, linksList):
'''
Accepts a list of tuples containing ('Link_title', 'url')
'''
self.links = list()
for linkTuple in linksList:
self.links.append(linkTuple)
def Set_context(self, **kwargs):
'''
The kwargs points to the dictionary keys in context, and the values are inserted
'''
for key in kwargs.keys():
self.context[key] = kwargs[key]
def importTextFile(self, filePath):
with open(filePath,'r') as fid:
self.textString = fid.read()
class indexPage(View):
def __init__(self, *args, **kwargs):
self.ContextObject = ContextBuilder()
self.ContextObject.importTextFile('static/mainAboutUs.txt')
self.ContextObject.Set_headerCoverImageLinks(linksList = [
('LOCATIONS', '#anchor_locations'),
('ABOUT US', '#anchor-aboutUs'),
('CONTACT', '#anchor-mainContact')
]
)
self.emailSignupForm = newsLetterForm()
self.ContextObject.Set_context(
links = self.ContextObject.links,
imagePath = 'static/media/cover.jpg',
aboutUsImagePath = 'static/media/aboutus2900.jpg',
aboutUsText = self.ContextObject.textString,
coverTitle1 = 'We are dimsum!',
coverTitle2 = 'at',
coverTitle3 = 'HIDDEN DIMSUM',
emailSignUpForm = self.emailSignupForm,
shopTitle = 'Hidden Dimsum',
addressStreet = 'Nytorv 19',
addressPostcodeCity = '1450 København K',
addressPhone = '+45-33 12 88 28')
self.context = self.ContextObject.context
def get(self, request, *args, **kwargs):
return render(request, template_name='index.html', context = self.context)
In my apache2 settings I have the below code where I have pointed the static alias to the folder in productionStatic. What have I missed?
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
Alias /static /home/jianwu/HD_website/website/productionStatic
<Directory /home/jianwu/HD_website/website/productionStatic>
Require all granted
</Directory>
Alias /media /home/jianwu/HD_website/website/media
<Directory /home/jianwu/HD_website/website/media>
Require all granted
</Directory>
<Directory /home/jianwu/HD_website/website/website>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/jianwu/HD_website/website/website/wsgi.py
WSGIDaemonProcess django_app python-path=/home/jianwu/HD_website/website python-home=/home/jianwu/HD_website/website/env
WSGIProcessGroup django_app
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
It is as commented by Ivan Starostin that one should give the absolute path in to the file in the production environment. Also using reverse url can also work in this case as suggested in the comment.
I think its this problem - django watching on mainApp but not on news app - django.template.loaders.app_directories.Loader: C:\Users\Name_User\Desktop\mysite\mainApp\templates\news\posts.html
but i dont know how repair it, iam very new in django
Directory of project
ERROR
TemplateDoesNotExist at /news
news/posts.html, news/articles_list.html
Request Method: GET
Request URL: http://127.0.0.1:8000/news
Django Version: 3.0.4
Exception Type: TemplateDoesNotExist
Exception Value:
news/posts.html, news/articles_list.html
Exception Location: C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\loader.py in select_template, line 47
Python Executable: C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\python.exe
Python Version: 3.7.4
Python Path:
['C:\\Users\\Victor.INC\\Desktop\\mysite',
'C:\\Users\\Victor.INC\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.zip',
'C:\\Users\\Victor.INC\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs',
'C:\\Users\\Victor.INC\\AppData\\Local\\Programs\\Python\\Python37-32\\lib',
'C:\\Users\\Victor.INC\\AppData\\Local\\Programs\\Python\\Python37-32',
'C:\\Users\\Victor.INC\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages',
'C:\\Users\\Victor.INC\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages\\south-1.0.2-py3.7.egg']
Server time: Sun, 29 Mar 2020 12:20:58 +0000
Template-loader postmortem
Django tried loading these templates, in this order:
Using engine django:
django.template.loaders.app_directories.Loader: C:\Users\Victor.INC\Desktop\mysite\mainApp\templates\news\posts.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\admin\templates\news\posts.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\auth\templates\news\posts.html (Source does not exist)
Using engine django:
django.template.loaders.app_directories.Loader: C:\Users\Victor.INC\Desktop\mysite\mainApp\templates\news\articles_list.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\admin\templates\news\articles_list.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\auth\templates\news\articles_list.html (Source does not exist)
Traceback Switch to copy-and-paste view
C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\exception.py in inner
response = get_response(request) …
▶ Local vars
C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py in _get_response
response = self.process_exception_by_middleware(e, request) …
▶ Local vars
C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py in _get_response
response = response.render() …
▶ Local vars
C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\response.py in render
self.content = self.rendered_content …
▶ Local vars
C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\response.py in rendered_content
template = self.resolve_template(self.template_name) …
▶ Local vars
C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\response.py in resolve_template
return select_template(template, using=self.using) …
▶ Local vars
C:\Users\Victor.INC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\template\loader.py in select_template
raise TemplateDoesNotExist(', '.join(template_name_list), chain=chain) …
▶ Local vars
Request information
USER
AnonymousUser
GET
No GET data
POST
No POST data
FILES
No FILES data
COOKIES
Variable Value
csrftoken
'LcLM03J6xPa80BrwSvUncgrrF8hBl7CnRlKOtYCxIf5HMTeYoNZVIBPHvcPcBbsr'
META
Variable Value
ALLUSERSPROFILE
'C:\\ProgramData'
APPDATA
'C:\\Users\\Victor.INC\\AppData\\Roaming'
COMMONPROGRAMFILES
'C:\\Program Files (x86)\\Common Files'
COMMONPROGRAMFILES(X86)
'C:\\Program Files (x86)\\Common Files'
COMMONPROGRAMW6432
'C:\\Program Files\\Common Files'
COMPUTERNAME
'DESKTOP-GKBKG6I'
COMSPEC
'C:\\WINDOWS\\system32\\cmd.exe'
CONTENT_LENGTH
''
CONTENT_TYPE
'text/plain'
CSRF_COOKIE
'LcLM03J6xPa80BrwSvUncgrrF8hBl7CnRlKOtYCxIf5HMTeYoNZVIBPHvcPcBbsr'
DJANGO_SETTINGS_MODULE
'mysite.settings'
DRIVERDATA
'C:\\Windows\\System32\\Drivers\\DriverData'
FPS_BROWSER_APP_PROFILE_STRING
'Internet Explorer'
FPS_BROWSER_USER_PROFILE_STRING
'Default'
GATEWAY_INTERFACE
'CGI/1.1'
HOMEDRIVE
'C:'
HOMEPATH
'\\Users\\Victor.INC'
HTTP_ACCEPT
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
HTTP_ACCEPT_ENCODING
'gzip, deflate, br'
HTTP_ACCEPT_LANGUAGE
'en-US,en;q=0.9'
HTTP_CACHE_CONTROL
'max-age=0'
HTTP_CONNECTION
'keep-alive'
HTTP_COOKIE
'csrftoken=LcLM03J6xPa80BrwSvUncgrrF8hBl7CnRlKOtYCxIf5HMTeYoNZVIBPHvcPcBbsr'
HTTP_HOST
'127.0.0.1:8000'
HTTP_REFERER
'http://127.0.0.1:8000/'
HTTP_SEC_FETCH_DEST
'document'
HTTP_SEC_FETCH_MODE
'navigate'
HTTP_SEC_FETCH_SITE
'same-origin'
HTTP_SEC_FETCH_USER
'?1'
HTTP_UPGRADE_INSECURE_REQUESTS
'1'
HTTP_USER_AGENT
('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like '
'Gecko) Chrome/80.0.3987.149 Safari/537.36')
JDK
'C:\\Games\\JAVA\\jdk1.8.0_141\\bin'
KOMPAS_SDK
'D:\\kompas\\SDK\\'
LOCALAPPDATA
'C:\\Users\\Victor.INC\\AppData\\Local'
LOGONSERVER
'\\\\DESKTOP-GKBKG6I'
NUMBER_OF_PROCESSORS
'4'
ONEDRIVE
'C:\\Users\\Victor.INC\\OneDrive'
OS
'Windows_NT'
PATH
('C:\\Program Files\\RailsInstaller\\Git\\cmd;C:\\Program '
'Files\\RailsInstaller\\Ruby2.2.0\\bin;C:\\Program Files (x86)\\Common '
'Files\\Oracle\\Java\\javapath;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Games\\iverilog\\gtkwave\\bin;C:\\Games\\iverilog\\bin;C:\\Program '
'Files (x86)\\NVIDIA '
'Corporation\\PhysX\\Common;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program '
'Files\\NVIDIA Corporation\\NVIDIA '
'NvDLISR;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program '
'Files\\wget;C:\\Users\\Victor.INC\\AppData\\Local\\Programs\\Python\\Python37-32\\Scripts\\;C:\\Users\\Victor.INC\\AppData\\Local\\Programs\\Python\\Python37-32\\;C:\\Games\\JAVA\\jdk1.8.0_141\\bin;C:\\Users\\Victor.INC\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Games\\Microsoft '
'VS '
'Code\\bin;C:\\Users\\Victor.INC\\AppData\\Local\\atom\\bin;%USERPROFILE%\\AppData\\Local\\Microsoft\\WindowsApps;')
PATHEXT
'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL'
PATH_INFO
'/news'
PROCESSOR_ARCHITECTURE
'x86'
PROCESSOR_ARCHITEW6432
'AMD64'
PROCESSOR_IDENTIFIER
'Intel64 Family 6 Model 58 Stepping 9, GenuineIntel'
PROCESSOR_LEVEL
'6'
PROCESSOR_REVISION
'3a09'
PROGRAMDATA
'C:\\ProgramData'
PROGRAMFILES
'C:\\Program Files (x86)'
PROGRAMFILES(X86)
'C:\\Program Files (x86)'
PROGRAMW6432
'C:\\Program Files'
PSMODULEPATH
('C:\\Users\\Victor.INC\\Documents\\WindowsPowerShell\\Modules;C:\\Program '
'Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules')
PUBLIC
'C:\\Users\\Public'
QUERY_STRING
''
REMOTE_ADDR
'127.0.0.1'
REMOTE_HOST
''
REQUEST_METHOD
'GET'
RUN_MAIN
'true'
SCRIPT_NAME
''
SERVER_NAME
'vortex.data.microsoft.com'
SERVER_PORT
'8000'
SERVER_PROTOCOL
'HTTP/1.1'
SERVER_SOFTWARE
'WSGIServer/0.2'
SESSIONNAME
'Console'
SYSTEMDRIVE
'C:'
SYSTEMROOT
'C:\\WINDOWS'
TEMP
'C:\\Users\\Victor.INC\\AppData\\Local\\Temp'
TMP
'C:\\Users\\Victor.INC\\AppData\\Local\\Temp'
USERDOMAIN
'DESKTOP-GKBKG6I'
USERDOMAIN_ROAMINGPROFILE
'DESKTOP-GKBKG6I'
USERNAME
'Victor.INC'
USERPROFILE
'C:\\Users\\Victor.INC'
WINDIR
'C:\\WINDOWS'
wsgi.errors
<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>
wsgi.file_wrapper
''
wsgi.input
<django.core.handlers.wsgi.LimitedStream object at 0x04995D90>
wsgi.multiprocess
False
wsgi.multithread
True
wsgi.run_once
False
wsgi.url_scheme
'http'
wsgi.version
(1, 0)
Settings
Using settings module mysite.settings
Setting Value
ABSOLUTE_URL_OVERRIDES
{}
ADMINS
[]
ALLOWED_HOSTS
[]
APPEND_SLASH
True
AUTHENTICATION_BACKENDS
['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS
'********************'
AUTH_USER_MODEL
'auth.User'
BASE_DIR
'C:\\Users\\Victor.INC\\Desktop\\mysite'
CACHES
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS
'default'
CACHE_MIDDLEWARE_KEY_PREFIX
'********************'
CACHE_MIDDLEWARE_SECONDS
600
CSRF_COOKIE_AGE
31449600
CSRF_COOKIE_DOMAIN
None
CSRF_COOKIE_HTTPONLY
False
CSRF_COOKIE_NAME
'csrftoken'
CSRF_COOKIE_PATH
'/'
CSRF_COOKIE_SAMESITE
'Lax'
CSRF_COOKIE_SECURE
False
CSRF_FAILURE_VIEW
'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME
'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS
[]
CSRF_USE_SESSIONS
False
DATABASES
{'default': {'ATOMIC_REQUESTS': False,
'AUTOCOMMIT': True,
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.sqlite3',
'HOST': '',
'NAME': 'C:\\Users\\Victor.INC\\Desktop\\mysite\\db.sqlite3',
'OPTIONS': {},
'PASSWORD': '********************',
'PORT': '',
'TEST': {'CHARSET': None,
'COLLATION': None,
'MIRROR': None,
'NAME': None},
'TIME_ZONE': None,
'USER': ''}}
DATABASE_ROUTERS
[]
DATA_UPLOAD_MAX_MEMORY_SIZE
2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS
1000
DATETIME_FORMAT
'N j, Y, P'
DATETIME_INPUT_FORMATS
['%Y-%m-%d %H:%M:%S',
'%Y-%m-%d %H:%M:%S.%f',
'%Y-%m-%d %H:%M',
'%Y-%m-%d',
'%m/%d/%Y %H:%M:%S',
'%m/%d/%Y %H:%M:%S.%f',
'%m/%d/%Y %H:%M',
'%m/%d/%Y',
'%m/%d/%y %H:%M:%S',
'%m/%d/%y %H:%M:%S.%f',
'%m/%d/%y %H:%M',
'%m/%d/%y']
DATE_FORMAT
'N j, Y'
DATE_INPUT_FORMATS
['%Y-%m-%d',
'%m/%d/%Y',
'%m/%d/%y',
'%b %d %Y',
'%b %d, %Y',
'%d %b %Y',
'%d %b, %Y',
'%B %d %Y',
'%B %d, %Y',
'%d %B %Y',
'%d %B, %Y']
DEBUG
True
DEBUG_PROPAGATE_EXCEPTIONS
False
DECIMAL_SEPARATOR
'.'
DEFAULT_CHARSET
'utf-8'
DEFAULT_EXCEPTION_REPORTER_FILTER
'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE
'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL
'webmaster#localhost'
DEFAULT_INDEX_TABLESPACE
''
DEFAULT_TABLESPACE
''
DISALLOWED_USER_AGENTS
[]
EMAIL_BACKEND
'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST
'localhost'
EMAIL_HOST_PASSWORD
'********************'
EMAIL_HOST_USER
''
EMAIL_PORT
25
EMAIL_SSL_CERTFILE
None
EMAIL_SSL_KEYFILE
'********************'
EMAIL_SUBJECT_PREFIX
'[Django] '
EMAIL_TIMEOUT
None
EMAIL_USE_LOCALTIME
False
EMAIL_USE_SSL
False
EMAIL_USE_TLS
False
FILE_CHARSET
'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS
None
FILE_UPLOAD_HANDLERS
['django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE
2621440
FILE_UPLOAD_PERMISSIONS
420
FILE_UPLOAD_TEMP_DIR
None
FIRST_DAY_OF_WEEK
0
FIXTURE_DIRS
[]
FORCE_SCRIPT_NAME
None
FORMAT_MODULE_PATH
None
FORM_RENDERER
'django.forms.renderers.DjangoTemplates'
IGNORABLE_404_URLS
[]
INSTALLED_APPS
['news',
'mainApp',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles']
INTERNAL_IPS
[]
LANGUAGES
[('af', 'Afrikaans'),
('ar', 'Arabic'),
('ast', 'Asturian'),
('az', 'Azerbaijani'),
('bg', 'Bulgarian'),
('be', 'Belarusian'),
('bn', 'Bengali'),
('br', 'Breton'),
('bs', 'Bosnian'),
('ca', 'Catalan'),
('cs', 'Czech'),
('cy', 'Welsh'),
('da', 'Danish'),
('de', 'German'),
('dsb', 'Lower Sorbian'),
('el', 'Greek'),
('en', 'English'),
('en-au', 'Australian English'),
('en-gb', 'British English'),
('eo', 'Esperanto'),
('es', 'Spanish'),
('es-ar', 'Argentinian Spanish'),
('es-co', 'Colombian Spanish'),
('es-mx', 'Mexican Spanish'),
('es-ni', 'Nicaraguan Spanish'),
('es-ve', 'Venezuelan Spanish'),
('et', 'Estonian'),
('eu', 'Basque'),
('fa', 'Persian'),
('fi', 'Finnish'),
('fr', 'French'),
('fy', 'Frisian'),
('ga', 'Irish'),
('gd', 'Scottish Gaelic'),
('gl', 'Galician'),
('he', 'Hebrew'),
('hi', 'Hindi'),
('hr', 'Croatian'),
('hsb', 'Upper Sorbian'),
('hu', 'Hungarian'),
('hy', 'Armenian'),
('ia', 'Interlingua'),
('id', 'Indonesian'),
('io', 'Ido'),
('is', 'Icelandic'),
('it', 'Italian'),
('ja', 'Japanese'),
('ka', 'Georgian'),
('kab', 'Kabyle'),
('kk', 'Kazakh'),
('km', 'Khmer'),
('kn', 'Kannada'),
('ko', 'Korean'),
('lb', 'Luxembourgish'),
('lt', 'Lithuanian'),
('lv', 'Latvian'),
('mk', 'Macedonian'),
('ml', 'Malayalam'),
('mn', 'Mongolian'),
('mr', 'Marathi'),
('my', 'Burmese'),
('nb', 'Norwegian Bokmål'),
('ne', 'Nepali'),
('nl', 'Dutch'),
('nn', 'Norwegian Nynorsk'),
('os', 'Ossetic'),
('pa', 'Punjabi'),
('pl', 'Polish'),
('pt', 'Portuguese'),
('pt-br', 'Brazilian Portuguese'),
('ro', 'Romanian'),
('ru', 'Russian'),
('sk', 'Slovak'),
('sl', 'Slovenian'),
('sq', 'Albanian'),
('sr', 'Serbian'),
('sr-latn', 'Serbian Latin'),
('sv', 'Swedish'),
('sw', 'Swahili'),
('ta', 'Tamil'),
('te', 'Telugu'),
('th', 'Thai'),
('tr', 'Turkish'),
('tt', 'Tatar'),
('udm', 'Udmurt'),
('uk', 'Ukrainian'),
('ur', 'Urdu'),
('uz', 'Uzbek'),
('vi', 'Vietnamese'),
('zh-hans', 'Simplified Chinese'),
('zh-hant', 'Traditional Chinese')]
LANGUAGES_BIDI
['he', 'ar', 'fa', 'ur']
LANGUAGE_CODE
'en-us'
LANGUAGE_COOKIE_AGE
None
LANGUAGE_COOKIE_DOMAIN
None
LANGUAGE_COOKIE_HTTPONLY
False
LANGUAGE_COOKIE_NAME
'django_language'
LANGUAGE_COOKIE_PATH
'/'
LANGUAGE_COOKIE_SAMESITE
None
LANGUAGE_COOKIE_SECURE
False
LOCALE_PATHS
[]
LOGGING
{}
LOGGING_CONFIG
'logging.config.dictConfig'
LOGIN_REDIRECT_URL
'/accounts/profile/'
LOGIN_URL
'/accounts/login/'
LOGOUT_REDIRECT_URL
None
MANAGERS
[]
MEDIA_ROOT
''
MEDIA_URL
''
MESSAGE_STORAGE
'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
MIGRATION_MODULES
{}
MONTH_DAY_FORMAT
'F j'
NUMBER_GROUPING
0
PASSWORD_HASHERS
'********************'
PASSWORD_RESET_TIMEOUT_DAYS
'********************'
PREPEND_WWW
False
ROOT_URLCONF
'mysite.urls'
SECRET_KEY
'********************'
SECURE_BROWSER_XSS_FILTER
False
SECURE_CONTENT_TYPE_NOSNIFF
True
SECURE_HSTS_INCLUDE_SUBDOMAINS
False
SECURE_HSTS_PRELOAD
False
SECURE_HSTS_SECONDS
0
SECURE_PROXY_SSL_HEADER
None
SECURE_REDIRECT_EXEMPT
[]
SECURE_REFERRER_POLICY
None
SECURE_SSL_HOST
None
SECURE_SSL_REDIRECT
False
SERVER_EMAIL
'root#localhost'
SESSION_CACHE_ALIAS
'default'
SESSION_COOKIE_AGE
1209600
SESSION_COOKIE_DOMAIN
None
SESSION_COOKIE_HTTPONLY
True
SESSION_COOKIE_NAME
'sessionid'
SESSION_COOKIE_PATH
'/'
SESSION_COOKIE_SAMESITE
'Lax'
SESSION_COOKIE_SECURE
False
SESSION_ENGINE
'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE
False
SESSION_FILE_PATH
None
SESSION_SAVE_EVERY_REQUEST
False
SESSION_SERIALIZER
'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE
'mysite.settings'
SHORT_DATETIME_FORMAT
'm/d/Y P'
SHORT_DATE_FORMAT
'm/d/Y'
SIGNING_BACKEND
'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS
[]
STATICFILES_DIRS
[]
STATICFILES_FINDERS
['django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE
'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT
None
STATIC_URL
'/static/'
TEMPLATES
[{'APP_DIRS': True,
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'OPTIONS': {'context_processors': ['django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages']}}]
TEST_NON_SERIALIZED_APPS
[]
TEST_RUNNER
'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR
','
TIME_FORMAT
'P'
TIME_INPUT_FORMATS
['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE
'UTC'
USE_I18N
True
USE_L10N
True
USE_THOUSAND_SEPARATOR
False
USE_TZ
True
USE_X_FORWARDED_HOST
False
USE_X_FORWARDED_PORT
False
WSGI_APPLICATION
'mysite.wsgi.application'
X_FRAME_OPTIONS
'DENY'
YEAR_MONTH_FORMAT
'F Y'
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard page generated by the handler for this status code.
settings.py
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 3.0.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'sczyf1%0st32=q#i=2dubq27#wv2jnv*y$zm_md)*$p(n3!5k)'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'news',
'mainApp',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'mysite.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'mysite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/
STATIC_URL = '/static/'
news/urls.py
from django.urls import path, include
from django.views.generic import ListView, DetailView
from news.models import Articles
app_name = 'news'
urlpatterns = [
path('', ListView.as_view(queryset = Articles.objects.all().order_by("-date")[:20], template_name="news/posts.html")),
]
news/models.py
from django.db import models
class Articles(models.Model):
title = models.CharField(max_length = 120)
post = models.TextField()
date = models.DateTimeField()
def __str__(self):
return self.title
posts.html
{% extends "mainApp/second_page_style.html" %}
{% block content %}
{% for post in object_list %}
<h3>{{post.title}}</h3>
<h5>{{post.date|date:"d-m-Y"}}</h5>
{% endfor }
{% endblock %}
I used the django-twoscoops project template to setup a simple project (made some modifications to use django 2.2.5). My project urls.py looks like this:
from django.contrib import admin
from django.urls import include, path
from django.conf import settings
from django.views.generic import TemplateView
urlpatterns = [
# Landing page.
path('', TemplateView.as_view(template_name='base.html')),
# Admin.
path('admin/', admin.site.urls),
# Apps.
path('polls/', include('apps.polls.urls')),
]
I ran check and no issues were found. When I run the server, and connect to 127.0.0.1:8000/admin/
I get an error. However, if I go to 127.0.0.1:8000/polls/ the polls page loads OK. I also get an error if I try to go to 127.0.0.1:8000 (it complains base.html is not found and I don't understand why it is looking at a different path). I am not sure what I am doing wrong.
Admin error:
OSError at /admin/login/
[Errno 22] Invalid argument: 'C:\\Users\\drpal\\PycharmProjects\\tvpv_portal\\:\\admin\\login.html'
Landing page error:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 2.2.5
Python Version: 3.7.5
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'apps.polls']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback:
File "C:\Anaconda3\lib\site-packages\django\core\handlers\exception.py" in inner
34. response = get_response(request)
File "C:\Anaconda3\lib\site-packages\django\core\handlers\base.py" in _get_response
145. response = self.process_exception_by_middleware(e, request)
File "C:\Anaconda3\lib\site-packages\django\core\handlers\base.py" in _get_response
143. response = response.render()
File "C:\Anaconda3\lib\site-packages\django\template\response.py" in render
106. self.content = self.rendered_content
File "C:\Anaconda3\lib\site-packages\django\template\response.py" in rendered_content
81. template = self.resolve_template(self.template_name)
File "C:\Anaconda3\lib\site-packages\django\template\response.py" in resolve_template
63. return select_template(template, using=self.using)
File "C:\Anaconda3\lib\site-packages\django\template\loader.py" in select_template
42. return engine.get_template(template_name)
File "C:\Anaconda3\lib\site-packages\django\template\backends\django.py" in get_template
34. return Template(self.engine.get_template(template_name), self)
File "C:\Anaconda3\lib\site-packages\django\template\engine.py" in get_template
143. template, origin = self.find_template(template_name)
File "C:\Anaconda3\lib\site-packages\django\template\engine.py" in find_template
125. template = loader.get_template(name, skip=skip)
File "C:\Anaconda3\lib\site-packages\django\template\loaders\base.py" in get_template
24. contents = self.get_contents(origin)
File "C:\Anaconda3\lib\site-packages\django\template\loaders\filesystem.py" in get_contents
23. with open(origin.name, encoding=self.engine.file_charset) as fp:
Exception Type: OSError at /
Exception Value: [Errno 22] Invalid argument: 'C:\\Users\\drpal\\PycharmProjects\\tvpv_portal\\:\\base.html'
For landing page, I have set 'DIRS' in TEMPLATE dictionary to point to C:\Users\drpal\PycharmProjects\tvpv_portal\templates which contains base.html, so I'm not sure why it is looking one directory above.
The settings are shown below but I am not sure what the culprit could be:
ABSOLUTE_URL_OVERRIDES
{}
ALLOWED_HOSTS
[]
APPEND_SLASH
True
AUTHENTICATION_BACKENDS
['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS
'********************'
AUTH_USER_MODEL
'auth.User'
CACHES
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS
'default'
CACHE_MIDDLEWARE_KEY_PREFIX
'********************'
CACHE_MIDDLEWARE_SECONDS
600
CSRF_COOKIE_AGE
31449600
CSRF_COOKIE_DOMAIN
None
CSRF_COOKIE_HTTPONLY
False
CSRF_COOKIE_NAME
'csrftoken'
CSRF_COOKIE_PATH
'/'
CSRF_COOKIE_SAMESITE
'Lax'
CSRF_COOKIE_SECURE
False
CSRF_FAILURE_VIEW
'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME
'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS
[]
CSRF_USE_SESSIONS
False
DATABASES
{'default': {'ATOMIC_REQUESTS': False,
'AUTOCOMMIT': True,
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.sqlite3',
'HOST': '',
'NAME': 'C:\\Users\\drpal\\PycharmProjects\\tvpv_portal\\tvpv_portal\\dev_db.sqlite3',
'OPTIONS': {},
'PASSWORD': '********************',
'PORT': '',
'TEST': {'CHARSET': None,
'COLLATION': None,
'MIRROR': None,
'NAME': None},
'TIME_ZONE': None,
'USER': ''}}
DATABASE_ROUTERS
[]
DATA_UPLOAD_MAX_MEMORY_SIZE
2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS
1000
DATETIME_FORMAT
'N j, Y, P'
DATETIME_INPUT_FORMATS
['%Y-%m-%d %H:%M:%S',
'%Y-%m-%d %H:%M:%S.%f',
'%Y-%m-%d %H:%M',
'%Y-%m-%d',
'%m/%d/%Y %H:%M:%S',
'%m/%d/%Y %H:%M:%S.%f',
'%m/%d/%Y %H:%M',
'%m/%d/%Y',
'%m/%d/%y %H:%M:%S',
'%m/%d/%y %H:%M:%S.%f',
'%m/%d/%y %H:%M',
'%m/%d/%y']
DATE_FORMAT
'N j, Y'
DATE_INPUT_FORMATS
['%Y-%m-%d',
'%m/%d/%Y',
'%m/%d/%y',
'%b %d %Y',
'%b %d, %Y',
'%d %b %Y',
'%d %b, %Y',
'%B %d %Y',
'%B %d, %Y',
'%d %B %Y',
'%d %B, %Y']
DEBUG
True
DEBUG_PROPAGATE_EXCEPTIONS
False
DECIMAL_SEPARATOR
'.'
DEFAULT_CHARSET
'utf-8'
DEFAULT_CONTENT_TYPE
'text/html'
DEFAULT_EXCEPTION_REPORTER_FILTER
'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE
'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL
'webmaster#localhost'
DEFAULT_INDEX_TABLESPACE
''
DEFAULT_TABLESPACE
''
DISALLOWED_USER_AGENTS
[]
DJANGO_APPS
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin']
DJANGO_ROOT
'C:\\Users\\drpal\\PycharmProjects\\tvpv_portal\\tvpv_portal'
EMAIL_BACKEND
'django.core.mail.backends.console.EmailBackend'
EMAIL_HOST
'localhost'
EMAIL_HOST_PASSWORD
'********************'
EMAIL_HOST_USER
''
EMAIL_PORT
25
EMAIL_SSL_CERTFILE
None
EMAIL_SSL_KEYFILE
'********************'
EMAIL_SUBJECT_PREFIX
'[Django] '
EMAIL_TIMEOUT
None
EMAIL_USE_LOCALTIME
False
EMAIL_USE_SSL
False
EMAIL_USE_TLS
False
FILE_CHARSET
'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS
None
FILE_UPLOAD_HANDLERS
['django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE
2621440
FILE_UPLOAD_PERMISSIONS
None
FILE_UPLOAD_TEMP_DIR
None
FIRST_DAY_OF_WEEK
0
FIXTURE_DIRS
('C:\\Users\\drpal\\PycharmProjects\\tvpv_portal\\fixtures',)
FORCE_SCRIPT_NAME
None
FORMAT_MODULE_PATH
None
FORM_RENDERER
'django.forms.renderers.DjangoTemplates'
IGNORABLE_404_URLS
[]
INSTALLED_APPS
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'apps.polls']
INTERNAL_IPS
[]
LANGUAGES
[('af', 'Afrikaans'),
('ar', 'Arabic'),
('ast', 'Asturian'),
('az', 'Azerbaijani'),
('bg', 'Bulgarian'),
('be', 'Belarusian'),
('bn', 'Bengali'),
('br', 'Breton'),
('bs', 'Bosnian'),
('ca', 'Catalan'),
('cs', 'Czech'),
('cy', 'Welsh'),
('da', 'Danish'),
('de', 'German'),
('dsb', 'Lower Sorbian'),
('el', 'Greek'),
('en', 'English'),
('en-au', 'Australian English'),
('en-gb', 'British English'),
('eo', 'Esperanto'),
('es', 'Spanish'),
('es-ar', 'Argentinian Spanish'),
('es-co', 'Colombian Spanish'),
('es-mx', 'Mexican Spanish'),
('es-ni', 'Nicaraguan Spanish'),
('es-ve', 'Venezuelan Spanish'),
('et', 'Estonian'),
('eu', 'Basque'),
('fa', 'Persian'),
('fi', 'Finnish'),
('fr', 'French'),
('fy', 'Frisian'),
('ga', 'Irish'),
('gd', 'Scottish Gaelic'),
('gl', 'Galician'),
('he', 'Hebrew'),
('hi', 'Hindi'),
('hr', 'Croatian'),
('hsb', 'Upper Sorbian'),
('hu', 'Hungarian'),
('hy', 'Armenian'),
('ia', 'Interlingua'),
('id', 'Indonesian'),
('io', 'Ido'),
('is', 'Icelandic'),
('it', 'Italian'),
('ja', 'Japanese'),
('ka', 'Georgian'),
('kab', 'Kabyle'),
('kk', 'Kazakh'),
('km', 'Khmer'),
('kn', 'Kannada'),
('ko', 'Korean'),
('lb', 'Luxembourgish'),
('lt', 'Lithuanian'),
('lv', 'Latvian'),
('mk', 'Macedonian'),
('ml', 'Malayalam'),
('mn', 'Mongolian'),
('mr', 'Marathi'),
('my', 'Burmese'),
('nb', 'Norwegian Bokmål'),
('ne', 'Nepali'),
('nl', 'Dutch'),
('nn', 'Norwegian Nynorsk'),
('os', 'Ossetic'),
('pa', 'Punjabi'),
('pl', 'Polish'),
('pt', 'Portuguese'),
('pt-br', 'Brazilian Portuguese'),
('ro', 'Romanian'),
('ru', 'Russian'),
('sk', 'Slovak'),
('sl', 'Slovenian'),
('sq', 'Albanian'),
('sr', 'Serbian'),
('sr-latn', 'Serbian Latin'),
('sv', 'Swedish'),
('sw', 'Swahili'),
('ta', 'Tamil'),
('te', 'Telugu'),
('th', 'Thai'),
('tr', 'Turkish'),
('tt', 'Tatar'),
('udm', 'Udmurt'),
('uk', 'Ukrainian'),
('ur', 'Urdu'),
('vi', 'Vietnamese'),
('zh-hans', 'Simplified Chinese'),
('zh-hant', 'Traditional Chinese')]
LANGUAGES_BIDI
['he', 'ar', 'fa', 'ur']
LANGUAGE_CODE
'en-us'
LANGUAGE_COOKIE_AGE
None
LANGUAGE_COOKIE_DOMAIN
None
LANGUAGE_COOKIE_NAME
'django_language'
LANGUAGE_COOKIE_PATH
'/'
LOCALE_PATHS
[]
LOCAL_APPS
['apps.polls']
LOGGING
{'disable_existing_loggers': False,
'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'},
'require_debug_true': {'()': 'django.utils.log.RequireDebugTrue'}},
'formatters': {'simple': {'format': '{levelname} {message}', 'style': '{'},
'verbose': {'format': '{levelname} {asctime} {module} '
'{process:d} {thread:d} {message}',
'style': '{'}},
'handlers': {'console': {'class': 'logging.StreamHandler',
'filters': ['require_debug_true'],
'formatter': 'simple',
'level': 'INFO'},
'mail_admins': {'class': 'django.utils.log.AdminEmailHandler',
'filters': ['require_debug_false'],
'formatter': 'simple',
'level': 'ERROR'}},
'loggers': {'django': {'handlers': ['console'], 'propagate': True},
'django.request': {'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True}},
'version': 1}
LOGGING_CONFIG
'logging.config.dictConfig'
LOGIN_REDIRECT_URL
'/accounts/profile/'
LOGIN_URL
'/accounts/login/'
LOGOUT_REDIRECT_URL
None
MEDIA_ROOT
'C:\\Users\\drpal\\PycharmProjects\\tvpv_portal\\media'
MEDIA_URL
'/media/'
MESSAGE_STORAGE
'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
MIGRATION_MODULES
{}
MONTH_DAY_FORMAT
'F j'
NUMBER_GROUPING
0
PASSWORD_HASHERS
'********************'
PASSWORD_RESET_TIMEOUT_DAYS
'********************'
PREPEND_WWW
False
ROOT_URLCONF
'tvpv_portal.urls'
SECRET_KEY
'********************'
SECURE_BROWSER_XSS_FILTER
False
SECURE_CONTENT_TYPE_NOSNIFF
False
SECURE_HSTS_INCLUDE_SUBDOMAINS
False
SECURE_HSTS_PRELOAD
False
SECURE_HSTS_SECONDS
0
SECURE_PROXY_SSL_HEADER
None
SECURE_REDIRECT_EXEMPT
[]
SECURE_SSL_HOST
None
SECURE_SSL_REDIRECT
False
SERVER_EMAIL
'root#localhost'
SESSION_CACHE_ALIAS
'default'
SESSION_COOKIE_AGE
1209600
SESSION_COOKIE_DOMAIN
None
SESSION_COOKIE_HTTPONLY
True
SESSION_COOKIE_NAME
'sessionid'
SESSION_COOKIE_PATH
'/'
SESSION_COOKIE_SAMESITE
'Lax'
SESSION_COOKIE_SECURE
False
SESSION_ENGINE
'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE
False
SESSION_FILE_PATH
None
SESSION_SAVE_EVERY_REQUEST
False
SESSION_SERIALIZER
'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE
'tvpv_portal.settings.dev'
SHORT_DATETIME_FORMAT
'm/d/Y P'
SHORT_DATE_FORMAT
'm/d/Y'
SIGNING_BACKEND
'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS
[]
SITE_ID
1
SITE_NAME
'tvpv_portal'
SITE_ROOT
'C:\\Users\\drpal\\PycharmProjects\\tvpv_portal'
STATICFILES_DIRS
[]
STATICFILES_FINDERS
['django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE
'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT
'C:\\Users\\drpal\\PycharmProjects\\tvpv_portal\\static'
STATIC_URL
'/static/'
TEMPLATES
[{'APP_DIRS': True,
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': 'C:\\Users\\drpal\\PycharmProjects\\tvpv_portal\\templates',
'OPTIONS': {'context_processors': ['django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.request',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages'],
'debug': True}}]
TEST_NON_SERIALIZED_APPS
[]
TEST_RUNNER
'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR
','
TIME_FORMAT
'P'
TIME_INPUT_FORMATS
['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE
'America/Los_Angeles'
USE_I18N
True
USE_L10N
True
USE_THOUSAND_SEPARATOR
False
USE_TZ
True
USE_X_FORWARDED_HOST
False
USE_X_FORWARDED_PORT
False
WSGI_APPLICATION
'tvpv_portal.wsgi.application'
X_FRAME_OPTIONS
'SAMEORIGIN'
YEAR_MONTH_FORMAT
'F Y'
I figured this out. Silly mistake. I was doing DIRS = normpath(...) in the TEMPLATES dictionary. Instead, it should be DIRS = [ normpath(...) ]. A list instead of a single value. Now it works.
I started using python-social-auth with Django 1.8 / Python 3.5 a couple weeks ago and was getting ready to work on getting user profile data beyond user name and email from Facebook and google when I noticed the "Deprecation notice - 03-12-2016" at https://github.com/omab/python-social-auth.
I uninstalled python-social-auth and installed social-auth-core and social-auth-app-django in it's place, as I understood was recommended at the page referenced above. I followed the "Migrating from python-social-auth to split social" steps at https://github.com/omab/python-social-auth/blob/master/MIGRATING_TO_SOCIAL.md, and now I'm getting the following error:
ImportError at /complete/facebook/ No module named 'social_core.contrib'
Could someone advise me on how to get this solved?
The traceback:
ImportError at /login/facebook/
No module named 'social_core.contrib'
Request Method: GET
Request URL: http://example.com:8000/login/facebook/?next=/
Django Version: 1.8
Exception Type: ImportError
Exception Value:
No module named 'social_core.contrib'
Exception Location: C:\__files\DJANGO\DJANGO_TRAIN_01\lib\site-packages\social_core\utils.py in import_module, line 52
Python Executable: C:\__files\DJANGO\DJANGO_TRAIN_01\Scripts\python.exe
Python Version: 3.5.1
Python Path:
['C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\src',
'C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\Scripts\\python35.zip',
'C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\DLLs',
'C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\lib',
'C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\Scripts',
'c:\\program files (x86)\\python35-32\\Lib',
'c:\\program files (x86)\\python35-32\\DLLs',
'C:\\__files\\DJANGO\\DJANGO_TRAIN_01',
'C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\lib\\site-packages']
Server time: Sun, 11 Dec 2016 01:05:05 -0600
Traceback Switch to copy-and-paste view
C:\__files\DJANGO\DJANGO_TRAIN_01\lib\site-packages\django\core\handlers\base.py in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
...
▶ Local vars
C:\__files\DJANGO\DJANGO_TRAIN_01\lib\site-packages\django\views\decorators\cache.py in _wrapped_view_func
response = view_func(request, *args, **kwargs)
...
▶ Local vars
C:\__files\DJANGO\DJANGO_TRAIN_01\lib\site-packages\social_django\utils.py in wrapper
backend, uri)
...
▶ Local vars
C:\__files\DJANGO\DJANGO_TRAIN_01\lib\site-packages\social_django\utils.py in load_backend
Backend = get_backend(BACKENDS, name)
...
▶ Local vars
C:\__files\DJANGO\DJANGO_TRAIN_01\lib\site-packages\social_core\backends\utils.py in get_backend
load_backends(backends, force_load=True)
...
▶ Local vars
C:\__files\DJANGO\DJANGO_TRAIN_01\lib\site-packages\social_core\backends\utils.py in load_backends
backend = module_member(auth_backend)
...
▶ Local vars
C:\__files\DJANGO\DJANGO_TRAIN_01\lib\site-packages\social_core\utils.py in module_member
module = import_module(mod)
...
▶ Local vars
C:\__files\DJANGO\DJANGO_TRAIN_01\lib\site-packages\social_core\utils.py in import_module
__import__(name)
...
▶ Local vars
Request information
GET
Variable Value
next
'/'
POST
No POST data
FILES
No FILES data
COOKIES
Variable Value
sessionid
'8pv390k2ombcrrihkqzaccb7y2x1r6hd'
csrftoken
'5W0PrAk5uR2T7HlttjyJm4fntXZwqZQ3'
META
Variable Value
HTTP_DNT
'1'
wsgi.multiprocess
False
SYSTEMROOT
'C:\\Windows'
_OLD_VIRTUAL_PATH
('C:\\Program Files (x86)\\Python35-32\\Scripts\\;C:\\Program Files '
'(x86)\\Python35-32\\;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Program '
'Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS '
'Client\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program '
'Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program '
'Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files '
'(x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files '
'(x86)\\Intel\\Intel(R) Management Engine '
'Components\\IPT;C:\\wamp\\bin\\php\\php5.6.15;C:\\Program Files '
'(x86)\\MySQL\\MySQL Utilities\\;C:\\Program Files (x86)\\MySQL\\MySQL '
'Utilities\\Doctrine extensions for PHP\\;C:\\Program Files '
'(x86)\\Skype\\Phone\\;C:\\Program Files\\gettext-iconv\\bin;C:\\Program '
'Files\\nodejs\\;C:\\Ruby22\\bin;C:\\Users\\U1\\AppData\\Roaming\\npm;C:\\Users\\U1\\AppData\\Local\\Programs\\Git\\cmd;C:\\Users\\U1\\AppData\\Local\\Programs\\Git\\mingw64\\bin;C:\\Users\\U1\\AppData\\Local\\Programs\\Git\\usr\\bin')
HTTP_ACCEPT
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
PATH
('C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\Scripts;C:\\Program Files '
'(x86)\\Python35-32\\Scripts\\;C:\\Program Files '
'(x86)\\Python35-32\\;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Program '
'Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS '
'Client\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program '
'Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program '
'Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files '
'(x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files '
'(x86)\\Intel\\Intel(R) Management Engine '
'Components\\IPT;C:\\wamp\\bin\\php\\php5.6.15;C:\\Program Files '
'(x86)\\MySQL\\MySQL Utilities\\;C:\\Program Files (x86)\\MySQL\\MySQL '
'Utilities\\Doctrine extensions for PHP\\;C:\\Program Files '
'(x86)\\Skype\\Phone\\;C:\\Program Files\\gettext-iconv\\bin;C:\\Program '
'Files\\nodejs\\;C:\\Ruby22\\bin;C:\\Users\\U1\\AppData\\Roaming\\npm;C:\\Users\\U1\\AppData\\Local\\Programs\\Git\\cmd;C:\\Users\\U1\\AppData\\Local\\Programs\\Git\\mingw64\\bin;C:\\Users\\U1\\AppData\\Local\\Programs\\Git\\usr\\bin')
SESSIONNAME
'Console'
SERVER_PORT
'8000'
WINDOWS_TRACING_LOGFILE
'C:\\BVTBin\\Tests\\installpackage\\csilogfile.log'
PROCESSOR_IDENTIFIER
'Intel64 Family 6 Model 60 Stepping 3, GenuineIntel'
HTTP_UPGRADE_INSECURE_REQUESTS
'1'
CONTENT_LENGTH
''
COMMONPROGRAMFILES
'C:\\Program Files (x86)\\Common Files'
PATHEXT
'.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW;.RB;.RBW'
COMMONPROGRAMFILES(X86)
'C:\\Program Files (x86)\\Common Files'
wsgi.version
(1, 0)
TEMP
'C:\\Users\\U1\\AppData\\Local\\Temp'
NUMBER_OF_PROCESSORS
'4'
HOMEPATH
'\\Users\\U1'
PROGRAMW6432
'C:\\Program Files'
QUERY_STRING
'next=/'
WINDOWS_TRACING_FLAGS
'3'
REMOTE_HOST
''
LOGONSERVER
'\\\\I11'
wsgi.multithread
True
ACTEL_FOR_ALTIUM_OVERRIDE
' '
USERNAME
'U1'
PUBLIC
'C:\\Users\\Public'
_OLD_VIRTUAL_PROMPT
'$P$G'
HTTP_ACCEPT_ENCODING
'gzip, deflate'
CONTENT_TYPE
'text/plain'
CSRF_COOKIE
'5W0PrAk5uR2T7HlttjyJm4fntXZwqZQ3'
SERVER_NAME
'lmlicenses.wip4.adobe.com'
SERVER_PROTOCOL
'HTTP/1.1'
DJANGO_ENV
'C:\\__files\\DJANGO\\django_env'
HTTP_USER_AGENT
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0'
FP_NO_HOST_CHECK
'NO'
HTTP_REFERER
'http://example.com:8000/'
wsgi.run_once
False
COMMONPROGRAMW6432
'C:\\Program Files\\Common Files'
HTTP_CONNECTION
'keep-alive'
wsgi.input
TMP
'C:\\Users\\U1\\AppData\\Local\\Temp'
PSMODULEPATH
'C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\'
SYSTEMDRIVE
'C:'
HTTP_ACCEPT_LANGUAGE
'en,es;q=0.7,en-US;q=0.3'
PHP_PEAR_PHP_BIN
'C:\\wamp\\bin\\php\\php5.6.15\\php.exe'
DJANGO_SETTINGS_MODULE
'central_config.settings'
APPDATA
'C:\\Users\\U1\\AppData\\Roaming'
PROGRAMDATA
'C:\\ProgramData'
PROGRAMFILES
'C:\\Program Files (x86)'
ALLUSERSPROFILE
'C:\\ProgramData'
WINDIR
'C:\\Windows'
VIRTUAL_ENV
'C:\\__files\\DJANGO\\DJANGO_TRAIN_01'
PROCESSOR_ARCHITECTURE
'x86'
SERVER_SOFTWARE
'WSGIServer/0.2'
USERDOMAIN
'I11'
REQUEST_METHOD
'GET'
PROMPT
'(DJANGO_TRAIN_01) $P$G'
ALTERA_FOR_ALTIUM_OVERRIDE
' '
USERPROFILE
'C:\\Users\\U1'
PROCESSOR_ARCHITEW6432
'AMD64'
REMOTE_ADDR
'127.0.0.1'
PROCESSOR_LEVEL
'6'
PROGRAMFILES(X86)
'C:\\Program Files (x86)'
COMSPEC
'C:\\Windows\\system32\\cmd.exe'
SCRIPT_NAME
''
HTTP_HOST
'example.com:8000'
PROCESSOR_REVISION
'3c03'
wsgi.errors
' mode='w' encoding='cp437'>
HTTP_COOKIE
('csrftoken=5W0PrAk5uR2T7HlttjyJm4fntXZwqZQ3; '
'sessionid=8pv390k2ombcrrihkqzaccb7y2x1r6hd')
wsgi.file_wrapper
''
XPYTHONPATH
'C:\\Program Files (x86)\\Python35-32\\Lib\\site-packages'
PATH_INFO
'/login/facebook/'
JAVA_HOME
'C:\\Program Files\\Java\\jdk1.8.0_66'
COMPUTERNAME
'I11'
RUN_MAIN
'true'
OS
'Windows_NT'
wsgi.url_scheme
'http'
LOCALAPPDATA
'C:\\Users\\U1\\AppData\\Local'
GATEWAY_INTERFACE
'CGI/1.1'
HOMEDRIVE
'C:'
Settings
sing settings module central_config.settings
etting Value
RISPY_TEMPLATE_PACK
'bootstrap3'
SOCIAL_AUTH_FACEBOOK_SECRET
'********************'
LANGUAGE_COOKIE_PATH
'/'
CACHE_MIDDLEWARE_SECONDS
600
TEMPLATES
[{'APP_DIRS': True,
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\src\\templates'],
'OPTIONS': {'context_processors': ['django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'social_django.context_processors.backends',
'social_django.context_processors.login_redirect',
'central_config.context_processors.one.locale',
'central_config.context_processors.one.equis']}}]
PASSWORD_HASHERS
'********************'
DATE_INPUT_FORMATS
('%Y-%m-%d',
'%m/%d/%Y',
'%m/%d/%y',
'%b %d %Y',
'%b %d, %Y',
'%d %b %Y',
'%d %b, %Y',
'%B %d %Y',
'%B %d, %Y',
'%d %B %Y',
'%d %B, %Y')
SESSION_COOKIE_PATH
'/'
ADMINS
()
INTERNAL_IPS
()
DEBUG
True
SECURE_SSL_REDIRECT
False
MONTH_DAY_FORMAT
'F j'
SOCIAL_AUTH_FACEBOOK_KEY
'********************'
TEST_RUNNER
'django.test.runner.DiscoverRunner'
MESSAGE_STORAGE
'django.contrib.messages.storage.fallback.FallbackStorage'
SESSION_COOKIE_DOMAIN
None
SESSION_SERIALIZER
'django.contrib.sessions.serializers.JSONSerializer'
STATIC_ROOT
'C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\static_in_env\\static_root'
TEMPLATE_CONTEXT_PROCESSORS
('django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages')
MANAGERS
()
CACHE_MIDDLEWARE_ALIAS
'default'
EMAIL_TIMEOUT
None
TIME_FORMAT
'P'
APPEND_SLASH
True
SILENCED_SYSTEM_CHECKS
[]
SHORT_DATETIME_FORMAT
'm/d/Y P'
DEFAULT_TABLESPACE
''
CSRF_COOKIE_PATH
'/'
TEMPLATE_LOADERS
('django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader')
STATICFILES_STORAGE
'django.contrib.staticfiles.storage.StaticFilesStorage'
EMAIL_BACKEND
'django.core.mail.backends.smtp.EmailBackend'
FILE_CHARSET
'utf-8'
ALLOWED_HOSTS
[]
LANGUAGE_COOKIE_DOMAIN
None
TEMPLATE_DEBUG
False
STATIC_URL
'/static/'
SECURE_SSL_HOST
None
STATICFILES_FINDERS
('django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder')
SECURE_HSTS_SECONDS
0
LANGUAGE_COOKIE_NAME
'django_language'
FIXTURE_DIRS
()
TEMPLATE_DIRS
()
CACHE_MIDDLEWARE_KEY_PREFIX
'********************'
USE_I18N
True
SESSION_ENGINE
'django.contrib.sessions.backends.db'
SECURE_PROXY_SSL_HEADER
None
TIME_ZONE
'UTC'
LANGUAGES_BIDI
('he', 'ar', 'fa', 'ur')
SESSION_EXPIRE_AT_BROWSER_CLOSE
True
PREPEND_WWW
False
DECIMAL_SEPARATOR
'.'
CACHES
{'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
DEBUG_PROPAGATE_EXCEPTIONS
False
FIRST_DAY_OF_WEEK
0
FORMAT_MODULE_PATH
None
USE_X_FORWARDED_HOST
False
THOUSAND_SEPARATOR
','
CSRF_COOKIE_NAME
'csrftoken'
DEFAULT_FROM_EMAIL
'webmaster#localhost'
DATETIME_FORMAT
'N j, Y, P'
DATABASES
{'default': {'ATOMIC_REQUESTS': False,
'AUTOCOMMIT': True,
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.sqlite3',
'HOST': '',
'NAME': 'C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\src\\db.sqlite3',
'OPTIONS': {},
'PASSWORD': '********************',
'PORT': '',
'TEST': {'CHARSET': None,
'COLLATION': None,
'MIRROR': None,
'NAME': None},
'TIME_ZONE': 'UTC',
'USER': ''}}
SESSION_FILE_PATH
None
CRISPY_FAIL_SILENTLY
False
X_FRAME_OPTIONS
'SAMEORIGIN'
CSRF_COOKIE_AGE
31449600
LOCALE_PATHS
('C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\src\\locale',)
DEFAULT_CONTENT_TYPE
'text/html'
CSRF_COOKIE_SECURE
False
ALLOWED_INCLUDE_ROOTS
()
LOGGING_CONFIG
'logging.config.dictConfig'
SESSION_COOKIE_NAME
'sessionid'
SECURE_CONTENT_TYPE_NOSNIFF
False
SOCIAL_AUTH_TWITTER_KEY
'********************'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET
'********************'
LANGUAGE_COOKIE_AGE
None
DEFAULT_CHARSET
'utf-8'
EMAIL_SSL_CERTFILE
None
LOGIN_REDIRECT_URL
'/'
DATE_FORMAT
'N j, Y'
FILE_UPLOAD_MAX_MEMORY_SIZE
2621440
EMAIL_HOST_PASSWORD
'********************'
DEFAULT_INDEX_TABLESPACE
''
CSRF_COOKIE_HTTPONLY
False
TEST_NON_SERIALIZED_APPS
[]
AUTH_PASSWORD_VALIDATORS
'********************'
AUTHENTICATION_BACKENDS
('social_core.backends.facebook.FacebookOAuth2',
'social_core.backends.google.GoogleOAuth2',
'social_core.backends.twitter.TwitterOAuth',
'social_core.contrib.auth.backends.ModelBackend')
ROOT_URLCONF
'central_config.urls'
USE_TZ
True
USE_THOUSAND_SEPARATOR
True
FILE_UPLOAD_HANDLERS
('django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler')
CSRF_COOKIE_DOMAIN
None
EMAIL_HOST
'smtp.gmail.com'
SOCIAL_AUTH_TWITTER_SECRET
'********************'
SESSION_SAVE_EVERY_REQUEST
True
SECURE_HSTS_INCLUDE_SUBDOMAINS
False
DEFAULT_EXCEPTION_REPORTER_FILTER
'django.views.debug.SafeExceptionReporterFilter'
SECURE_REDIRECT_EXEMPT
[]
IGNORABLE_404_URLS
()
ACCOUNT_ACTIVATION_DAYS
7
STATICFILES_DIRS
('C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\src\\static_in_pro\\our_static',)
SESSION_COOKIE_AGE
180
CSRF_FAILURE_VIEW
'django.views.csrf.csrf_failure'
FORCE_SCRIPT_NAME
None
EMAIL_USE_SSL
False
SERVER_EMAIL
'root#localhost'
FILE_UPLOAD_PERMISSIONS
None
YEAR_MONTH_FORMAT
'F Y'
INSTALLED_APPS
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'social_django',
'crispy_forms',
'registration',
'central',
'filehand',
'cronosales',
'devtests']
SECURE_BROWSER_XSS_FILTER
False
SESSION_COOKIE_SECURE
False
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY
'********************'
EMAIL_SSL_KEYFILE
'********************'
SECRET_KEY
'********************'
USE_ETAGS
False
LOGGING
{}
MIGRATION_MODULES
{}
DATETIME_INPUT_FORMATS
('%Y-%m-%d %H:%M:%S',
'%Y-%m-%d %H:%M:%S.%f',
'%Y-%m-%d %H:%M',
'%Y-%m-%d',
'%m/%d/%Y %H:%M:%S',
'%m/%d/%Y %H:%M:%S.%f',
'%m/%d/%Y %H:%M',
'%m/%d/%Y',
'%m/%d/%y %H:%M:%S',
'%m/%d/%y %H:%M:%S.%f',
'%m/%d/%y %H:%M',
'%m/%d/%y')
MEDIA_URL
'/media/'
EMAIL_HOST_USER
'xoselor#gmail.com'
SESSION_CACHE_ALIAS
'default'
EMAIL_PORT
587
PASSWORD_RESET_TIMEOUT_DAYS
'********************'
NUMBER_GROUPING
0
LANGUAGE_CODE
'es'
LOGIN_URL
'/accounts/login/'
SHORT_DATE_FORMAT
'm/d/Y'
ABSOLUTE_URL_OVERRIDES
{}
MIDDLEWARE_CLASSES
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'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']
DEFAULT_FILE_STORAGE
'django.core.files.storage.FileSystemStorage'
REGISTRATION_AUTO_LOGIN
True
TEMPLATE_STRING_IF_INVALID
''
AUTH_USER_MODEL
'auth.User'
SIGNING_BACKEND
'django.core.signing.TimestampSigner'
DATABASE_ROUTERS
[]
USE_L10N
True
SESSION_COOKIE_HTTPONLY
True
WSGI_APPLICATION
'central_config.wsgi.application'
EMAIL_SUBJECT_PREFIX
'[Django] '
EMAIL_USE_TLS
True
FILE_UPLOAD_TEMP_DIR
None
SITE_ID
1
LANGUAGES
[('es', .__proxy__ object at 0x02CACC90>),
('en', .__proxy__ object at 0x02CACC70>),
('de', .__proxy__ object at 0x02CACCD0>)]
DISALLOWED_USER_AGENTS
()
FILE_UPLOAD_DIRECTORY_PERMISSIONS
None
MEDIA_ROOT
'C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\static_in_env\\media_root'
SETTINGS_MODULE
'central_config.settings'
LOGOUT_URL
'/accounts/logout/'
TIME_INPUT_FORMATS
('%H:%M:%S', '%H:%M:%S.%f', '%H:%M')
BASE_DIR
'C:\\__files\\DJANGO\\DJANGO_TRAIN_01\\src'
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard page generated by the handler for this status code.