Please add this line below static_url STATICFILES_DIRS = [ 'static' ]
On Thu, Feb 3, 2022, 20:53 Serge Alard <[email protected]> wrote: > Hello > > I developped a project in Django python that works fine. Thus, I deployed > my project. Everything works but the static files are not found by the > application. > I give you below the settings and wsgi files. > > *WSGI* > import os > > from django.core.wsgi import get_wsgi_application > > os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Web_bridge.settings') > > application = get_wsgi_application() > > *SETTINGS* > import os > from pathlib import Path > > os.environ['ENV'] = 'PRODUCTION' > > BASE_DIR = Path(__file__).resolve(strict=True).parent.parent > > DEBUG = False > SECRET_KEY = > 'django-insecure-eqlug^3e20v1c5%mo9*mhhea^vv$!$&hyiz-tr%x&6!@6$+e%7' > ALLOWED_HOSTS = ['*'] > > STATIC_ROOT = os.path.join(BASE_DIR, "static") > > INSTALLED_APPS = [ > 'bridge.apps.BridgeConfig', > 'django.contrib.admin', > 'django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.messages', > 'django.contrib.staticfiles', > 'django.contrib.sites', > ] > > 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 = 'Web_bridge.urls' > > TEMPLATES = [ > { > 'BACKEND': 'django.template.backends.django.DjangoTemplates', > 'DIRS': [BASE_DIR / '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 = 'Web_bridge.wsgi.application' > > DATABASES = { > 'default': { > 'ENGINE': 'django.db.backends.postgresql', # on utilise l'adaptateur > postgresql > 'NAME': 'sudoku_bridge', # le nom de notre base de donnees creee > precedemment > 'USER': 'sudoku', # attention : remplacez par votre nom d'utilisateur > 'PASSWORD': '*', > 'HOST': 'postgresql-sudoku.alwaysdata.net', > 'PORT': '5432', > 'CONN_MAX_AGE': 500, > } > } > > 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', > }, > ] > > LANGUAGE_CODE = 'fr-FR' > > TIME_ZONE = 'Europe/Paris' > > USE_I18N = True > > USE_L10N = True > > USE_TZ = False > > STATIC_URL = 'static/' > > Thank you in advance to help me. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/1c8bda14-d16f-405f-9c66-29e63275419bn%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/1c8bda14-d16f-405f-9c66-29e63275419bn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF7qQgD5cHEDVcoCtL6JNJQyg%3Dhqr15bskOg6RWCKKn4-YCreQ%40mail.gmail.com.

