trying a switch in production mode (debug=False in setting.py), I launched the python manage.py collectstatic command. from that moment when I try to connect to the site it gives me an internal error 500 even if I start the command via python manage.py runserver 0.0.0.0:8000
this is my setting.py:
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__)))
TEMPLATE_DIR = os.path.join(BASE_DIR,'Game/template/game')
MEDIA_DIR = os.path.join(BASE_DIR,'game/media')
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '**************************************'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ['<server-ip>','<server-domain>',]
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'Accounts',
'Game',
'marketing',
'Blog',
'contactus',
'django_filters',
'widget_tweaks',
'debug_toolbar',
'tempus_dominus',
'bootstrap3_datetime',
'django_summernote',
'session_security',
]
SUMMERNOTE_THEME = 'bs4'
#SESSION SECURITY SETTINGS
SESSION_SECURITY_WARN_AFTER = 540
SESSION_SECURITY_EXPIRE_AFTER = 1800
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
MIDDLEWARE = [
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'session_security.middleware.SessionSecurityMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
ROOT_URLCONF = 'CicloPost.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 = 'CicloPost.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
# Password validation
# https://docs.djangoproject.com/en/2.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/2.1/topics/i18n/
LANGUAGE_CODE = 'it-IT'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = False
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR,'static')
#MEDIA
MEDIA_ROOT =os.path.join(BASE_DIR,'game/media')
MEDIA_URL = '/media/'
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL= '/'
INTERNAL_IPS = ('127.0.0.1',)
i also have this error when i do collectstatic:
Post-processing 'js/plugin/revolution/css/settings.css' failed!
Traceback (most recent call last): File "manage.py", line 15, in execute_from_command_line(sys.argv) File "/opt/ciclo_proj/CicloPost/ciclo_env/lib/python3.6/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/opt/ciclo_proj/CicloPost/ciclo_env/lib/python3.6/site-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/ciclo_proj/CicloPost/ciclo_env/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv self.execute(*args, **cmd_options) File "/opt/ciclo_proj/CicloPost/ciclo_env/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute output = self.handle(*args, **options) File "/opt/ciclo_proj/CicloPost/ciclo_env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 188, in handle collected = self.collect() File "/opt/ciclo_proj/CicloPost/ciclo_env/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 134, in collect raise processed File "/opt/ciclo_proj/CicloPost/ciclo_env/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 293, in _post_process content = pattern.sub(converter, content) File "/opt/ciclo_proj/CicloPost/ciclo_env/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 194, in converter force=True, hashed_files=hashed_files, File "/opt/ciclo_proj/CicloPost/ciclo_env/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 131, in _url hashed_name = hashed_name_func(*args) File "/opt/ciclo_proj/CicloPost/ciclo_env/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 342, in _stored_name cache_name = self.clean_name(self.hashed_name(name)) File "/opt/ciclo_proj/CicloPost/ciclo_env/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 92, in hashed_name raise ValueError("The file '%s' could not be found with %r." % (filename, self)) ValueError: The file 'js/plugin/revolution/css/openhand.cur' could not be found with .
in production mode (debug=False in setting.py), I launched
or devno if Debug=False i don't have any error
mode? It's not clear from your desription and some of your assertions conflict with each other. – Ivan Starostin