Nandan
Nandan

Reputation: 422

Django not finding the static files

I am creating django project so root directory doesn't have any static folder i have two static folder in two app admin_panel and project respectively but when i run python manage.py collectstatic its shows file or folder not found:

Note: virtualenv is a project folder not venv environment

FileNotFoundError: [Errno 2] No such file or directory: '/home/tbosss/Desktop/environment/virtualenv/myproject/static'

STATICFILES_DIRS = (

('admin_panel', os.path.join(BASE_DIR, 'admin_panel', 'static')),
('project', os.path.join(BASE_DIR, 'project', 'static')),

)

STATIC_ROOT = '/static'

i dont know what will be the value of static root because there two static folder inside my apps not at root location

Upvotes: 0

Views: 1079

Answers (1)

Rakib
Rakib

Reputation: 327

Check if the BASE_DIR in settings.py points to your project base directory:

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

Now, based on your FileNotFoundError the static folder directory should be in the project base directory. So, the STATIC_ROOT should be:

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

Upvotes: 1

Related Questions