Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

You're using the staticfiles app without having set the required STATIC_URL setting – Django

I have 5 months of experience in django and I can not just find the solution of the error which I encounter.
I think it depends on frontend files, I can not deal with static files right now
Recently, I have been building a chat app called PyChatt

Whole project available on Github -> here
Please I need your help urgently!!!

traceback:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Traceback (most recent call last):
File "C:\Users\pytho\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1016, in 
_bootstrap_inner
self.run()
File "C:\Users\pytho\AppData\Local\Programs\Python\Python310\lib\threading.py", line 953, in 
run
self._target(*self._args, **self._kwargs)
File "D:\python_projects\Webogram\Internal\lib\site-packages\django\utils\autoreload.py", line 
64, in wrapper
fn(*args, **kwargs)
File "D:\python_projects\Webogram\Internal\lib\site- 
packages\django\core\management\commands\runserver.py", line 157, in inner_run
handler = self.get_handler(*args, **options)
File "D:\python_projects\Webogram\Internal\lib\site- 
packages\django\contrib\staticfiles\management\commands\runserver.py", line 35, in get_handler
return StaticFilesHandler(handler)
File "D:\python_projects\Webogram\Internal\lib\site- 
packages\django\contrib\staticfiles\handlers.py", line 75, in __init__
self.base_url = urlparse(self.get_base_url())
File "D:\python_projects\Webogram\Internal\lib\site- 
packages\django\contrib\staticfiles\handlers.py", line 30, in get_base_url
utils.check_settings()
File "D:\python_projects\Webogram\Internal\lib\site- 
packages\django\contrib\staticfiles\utils.py", line 49, in check_settings
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having 
set the required STATIC_URL setting.

and settings.py:

from pathlib import Path
import os

BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-pke21+-&vpt2=ka6$a_=x5vz-@#_)o^ro#eet+h03sy&y-l+8w'
DEBUG = True
ALLOWED_HOSTS = ["*"]

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'UsersAuthentication',
    'MessageHandleEngine',
]

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 = 'config.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR.joinpath("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 = 'config.wsgi.application'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'Chat-Database',
        'HOST': 'localhost',
        "PASSWORD": "20051205",
        "USER": "postgres"
    }
}
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',
    },
]

MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, "staticfiles"),
)

LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
STATIC_URl = "/static/"
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

>Solution :

STATIC_URl = "/static/"

should be STATIC_URL

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading