Try creating an account on my website:
And it presents the error:
ProgrammingError at /
relation "auth_user" does not exist
LINE 1: SELECT (1) AS "a" FROM "auth_user" WHERE "auth_user"."userna...
^
Request Method: POST
Request URL: https://abstract-spacecraft.herokuapp.com/
Django Version: 4.0.1
Exception Type: ProgrammingError
Exception Value:
relation "auth_user" does not exist
LINE 1: SELECT (1) AS "a" FROM "auth_user" WHERE "auth_user"."userna...
^
Exception Location: /app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py, line 85, in _execute
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.9.9
Python Path:
['/app/.heroku/python/bin',
'/app',
'/app/.heroku/python/lib/python39.zip',
'/app/.heroku/python/lib/python3.9',
'/app/.heroku/python/lib/python3.9/lib-dynload',
'/app/.heroku/python/lib/python3.9/site-packages']
Server time: Mon, 10 Jan 2022 20:36:09 +0000
Traceback Switch to copy-and-paste view
/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py, line 85, in _execute
return self.cursor.execute(sql, params) …
Local vars
The above exception (relation "auth_user" does not exist LINE 1: SELECT (1) AS "a" FROM "auth_user" WHERE "auth_user"."userna... ^ ) was the direct cause of the following exception:
/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/exception.py, line 47, in inner
response = get_response(request) …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/core/handlers/base.py, line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs) …
Local vars
/app/accounts/views.py, line 10, in sign_up
if form.is_valid(): …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/forms/forms.py, line 190, in is_valid
return self.is_bound and not self.errors …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/forms/forms.py, line 185, in errors
self.full_clean() …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/forms/forms.py, line 406, in full_clean
self._post_clean() …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/contrib/auth/forms.py, line 120, in _post_clean
super()._post_clean() …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/forms/models.py, line 417, in _post_clean
self.validate_unique() …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/forms/models.py, line 426, in validate_unique
self.instance.validate_unique(exclude=exclude) …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/db/models/base.py, line 1033, in validate_unique
errors = self._perform_unique_checks(unique_checks) …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/db/models/base.py, line 1136, in _perform_unique_checks
if qs.exists(): …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/db/models/query.py, line 815, in exists
return self.query.has_results(using=self.db) …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/db/models/sql/query.py, line 549, in has_results
return compiler.has_results() …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/db/models/sql/compiler.py, line 1172, in has_results
return bool(self.execute_sql(SINGLE)) …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/db/models/sql/compiler.py, line 1202, in execute_sql
cursor.execute(sql, params) …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py, line 99, in execute
return super().execute(sql, params) …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py, line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py, line 76, in _execute_with_wrappers
return executor(sql, params, many, context) …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py, line 85, in _execute
return self.cursor.execute(sql, params) …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/db/utils.py, line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value …
Local vars
/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/utils.py, line 85, in _execute
return self.cursor.execute(sql, params) …
Local vars
Request information
USER
AnonymousUser
GET
No GET data
POST
Variable Value
csrfmiddlewaretoken
'TG0EV0INh51nM0rpqjRiEMBv1RxBOkK7y3bDn7QFKK9Sv35ZKqKXEIanwCNbibr4'
username
'SillyMe'
password1
'CleverYou'
password2
'CleverYou'
FILES
No FILES data
COOKIES
Variable Value
csrftoken
'UjXGopoyl27m4HOu5OQjP0urMz52YMBWzG8FQwwqOHfRNKs4pVJYPW3jhklCsDiT'
META
Variable Value
CONTENT_LENGTH
'141'
CONTENT_TYPE
'application/x-www-form-urlencoded'
CSRF_COOKIE
'UjXGopoyl27m4HOu5OQjP0urMz52YMBWzG8FQwwqOHfRNKs4pVJYPW3jhklCsDiT'
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_CONNECTION
'close'
HTTP_CONNECT_TIME
'0'
HTTP_COOKIE
'csrftoken=UjXGopoyl27m4HOu5OQjP0urMz52YMBWzG8FQwwqOHfRNKs4pVJYPW3jhklCsDiT'
HTTP_HOST
'abstract-spacecraft.herokuapp.com'
HTTP_ORIGIN
'https://abstract-spacecraft.herokuapp.com'
HTTP_REFERER
'https://abstract-spacecraft.herokuapp.com/'
HTTP_SEC_CH_UA
'" Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"'
HTTP_SEC_CH_UA_MOBILE
'?0'
HTTP_SEC_CH_UA_PLATFORM
'"Windows"'
HTTP_SEC_FETCH_DEST
'document'
HTTP_SEC_FETCH_MODE
'navigate'
HTTP_SEC_FETCH_SITE
'same-origin'
HTTP_SEC_FETCH_USER
'?1'
HTTP_TOTAL_ROUTE_TIME
'0'
HTTP_UPGRADE_INSECURE_REQUESTS
'1'
HTTP_USER_AGENT
('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like '
'Gecko) Chrome/96.0.4664.110 Safari/537.36')
HTTP_VIA
'1.1 vegur'
HTTP_X_FORWARDED_FOR
'76.171.177.8'
HTTP_X_FORWARDED_PORT
'443'
HTTP_X_FORWARDED_PROTO
'https'
HTTP_X_REQUEST_ID
'3645bcc1-81ed-4720-a5f3-a0413f8a7f48'
HTTP_X_REQUEST_START
'1641846969257'
PATH_INFO
'/'
QUERY_STRING
''
RAW_URI
'/'
REMOTE_ADDR
'10.1.19.95'
REMOTE_PORT
'11016'
REQUEST_METHOD
'POST'
SCRIPT_NAME
''
SERVER_NAME
'0.0.0.0'
SERVER_PORT
'13732'
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.18.241.78', 13732), raddr=('10.1.19.95', 11016)>
wsgi.errors
<gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f2490481820>
wsgi.file_wrapper
<class 'gunicorn.http.wsgi.FileWrapper'>
wsgi.input
<gunicorn.http.body.Body object at 0x7f24904817f0>
wsgi.input_terminated
True
wsgi.multiprocess
True
wsgi.multithread
False
wsgi.run_once
False
wsgi.url_scheme
'https'
wsgi.version
(1, 0)
Settings
Using settings module abstract_spacecraft.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
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': 600,
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': 'ec2-18-209-169-66.compute-1.amazonaws.com',
'NAME': 'de59vkiptaedn7',
'OPTIONS': {'sslmode': 'require'},
'PASSWORD': '********************',
'PORT': 5432,
'TEST': {'CHARSET': None,
'COLLATION': None,
'MIGRATE': True,
'MIRROR': None,
'NAME': None},
'TIME_ZONE': None,
'USER': 'frwgsoqsvpncfc'}}
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.AutoField'
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',
'accounts.apps.AccountsConfig',
'whitenoise.runserver_nostatic',
'django_bootstrap5',
'cd_editor.apps.CdEditorConfig',
'database.apps.DatabaseConfig',
'django_neomodel']
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
{'disable_existing_loggers': False,
'formatters': {'simple': {'format': '%(levelname)s %(message)s'},
'verbose': {'datefmt': '%Y-%m-%d %H:%M:%S',
'format': '%(asctime)s [%(process)d] '
'[%(levelname)s] pathname=%(pathname)s '
'lineno=%(lineno)s funcname=%(funcName)s '
'%(message)s'}},
'handlers': {'console': {'class': 'logging.StreamHandler',
'formatter': 'verbose',
'level': 'DEBUG'},
'null': {'class': 'logging.NullHandler', 'level': 'DEBUG'}},
'loggers': {'testlogger': {'handlers': ['console'], 'level': 'INFO'}},
'version': 1}
LOGGING_CONFIG
'logging.config.dictConfig'
LOGIN_REDIRECT_URL
'/accounts/profile/'
LOGIN_URL
'/accounts/login/'
LOGOUT_REDIRECT_URL
None
MANAGERS
[]
MAX_BAD_CONN_RETRIES
5
MAX_PASSWORD_LENGTH
'********************'
MAX_TEXT_LENGTH
80
MAX_USERNAME_LENGTH
50
MAX_USER_EDIT_DIAGRAMS
8
MEDIA_ROOT
''
MEDIA_URL
'/'
MESSAGE_STORAGE
'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE
('whitenoise.middleware.WhiteNoiseMiddleware',
'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',
'whitenoise.middleware.WhiteNoiseMiddleware')
MIGRATION_MODULES
{}
MONTH_DAY_FORMAT
'F j'
NEOMODEL_ENCRYPTED_CONNECTION
False
NEOMODEL_FORCE_TIMEZONE
False
NEOMODEL_NEO4J_BOLT_URL
'neo4j+s://neo4j:fusion123@localhost:7687'
NEOMODEL_SIGNALS
True
NUMBER_GROUPING
0
PASSWORD_HASHERS
'********************'
PASSWORD_RESET_TIMEOUT
'********************'
PREPEND_WWW
False
ROOT_URLCONF
'abstract_spacecraft.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
'abstract_spacecraft.settings'
SETTINGS_PATH
'/app'
SHORT_DATETIME_FORMAT
'm/d/Y P'
SHORT_DATE_FORMAT
'm/d/Y'
SIGNING_BACKEND
'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS
[]
SITE_ROOT
'/app'
STATICFILES_DIRS
('/app/static/',)
STATICFILES_FINDERS
['django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE
'whitenoise.storage.CompressedManifestStaticFilesStorage'
STATIC_ROOT
'/app/staticfiles'
STATIC_URL
'/static/'
TEMPLATES
[{'APP_DIRS': True,
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['/app/templates',
'/app/templates/abstract_spacecraft',
'/app/templates/accounts',
'/app/templates/cd_editor',
'/app/templates/database'],
'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'],
'debug': True}}]
TEMPLATES_PATH
'/app/templates'
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
'abstract_spacecraft.wsgi.application'
X_FRAME_OPTIONS
'ALLOW'
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.
All I did was deploy to heroku/PostgreSQL from github/local/SQLite following these instructions:
Not sure what to make of it.
My settings.py reads:
"""
Django settings for abstract_spacecraft project.
Generated by 'django-admin startproject' using Django 3.1.5.
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 django_heroku
import dj_database_url
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
SETTINGS_PATH = os.path.dirname(os.path.dirname(__file__))
# 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 = os.environ.get('SECRET_KEY', 'TODO: use secret key in deployment')
# SECURITY WARNING: don't run with debug turned on in production!
if os.environ.get('ON_HEROKU', '0') == '0':
DEBUG = True
else:
DEBUG = False
# SECURITY WARNING: don't run with debug turned on in production!
#DEBUG = True # TODO comment out
ALLOWED_HOSTS = [
'127.0.0.1',
'abstract-spacecraft.herokuapp.com/',
]
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'accounts.apps.AccountsConfig',
'whitenoise.runserver_nostatic',
'django_bootstrap5',
'cd_editor.apps.CdEditorConfig',
'database.apps.DatabaseConfig',
'django_neomodel',
]
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',
'whitenoise.middleware.WhiteNoiseMiddleware',
]
ROOT_URLCONF = 'abstract_spacecraft.urls'
TEMPLATES_PATH = os.path.join(SETTINGS_PATH, 'templates')
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [TEMPLATES_PATH,
os.path.join(TEMPLATES_PATH, 'abstract_spacecraft'),
os.path.join(TEMPLATES_PATH, 'accounts'),
os.path.join(TEMPLATES_PATH, 'cd_editor'),
os.path.join(TEMPLATES_PATH, 'database')],
'APP_DIRS': True,
'OPTIONS': {
'debug': True,
'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 = 'abstract_spacecraft.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
if os.environ.get('ON_HEROKU', '0') == '0':
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
else:
DATABASES = {
# TODO: what does this max_age setting do?
'default' : dj_database_url.config(conn_max_age=600)
}
# 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/'
STATICFILES_DIRS = (
os.path.join(SITE_ROOT, 'static/'),)
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
def neo4j_url():
url = os.environ.get('NEO4J_SCHEMA', 'bolt') + "://"
url += os.environ.get('NEO4J_USERNAME', 'neo4j') + ":"
url += os.environ.get('NEO4J_PASSWORD', 'fusion123') + "@"
url += os.environ.get('NEO4J_HOST', 'localhost') + ":"
url += os.environ.get('NEO4J_PORT', '7687')
return url
NEOMODEL_NEO4J_BOLT_URL = neo4j_url()
NEOMODEL_SIGNALS = True
NEOMODEL_FORCE_TIMEZONE = False
NEOMODEL_ENCRYPTED_CONNECTION = False # TODO: how do we switch this on without error?
from neomodel import config # BUGFIX: had to do it this way
config.MAX_POOL_SIZE = 50 # TODO: what does this affect?
#LOGIN_REDIRECT_URL = 'home'
#LOGOUT_REDIRECT_URL = 'home'
# TODO: Enable Click-jacking protection
X_FRAME_OPTIONS = 'ALLOW' # ie set this to "DENY"
# https://docs.djangoproject.com/en/1.11/ref/clickjacking/
MAX_TEXT_LENGTH = 80
MAX_USERNAME_LENGTH = 50
MAX_PASSWORD_LENGTH = 50
MAX_USER_EDIT_DIAGRAMS = 8
MAX_BAD_CONN_RETRIES = 5
# Activate Django-Heroku.
django_heroku.settings(locals())
#MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'