I am working on a multi-app website. And I have bunch of noob questions. My dir structure looks like as below:
/var/www/html/portal
src/
manage.py
portal/
static/
admin/
css/
img/
js/
fonts/
templates/
base.html
homepage.html
venv/
- Is my dir structure as per as Django standards?
Are my
STATICfiles settings correct?STATIC_URL = '/static/' STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), )
Or should it be
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
- Should I
collectstaticafter copying all my static files such as css,js etc or I can do it before copying files in those dirs? - If I do
collectstaticwithout mentioning STATIC_ROOT I get an exceptiondjango.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
But when I replace STATICFILES_DIRS with the following, my .css files stop serving. What am I doing wrong?
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')