13👍
You do it wrong. You shouldn’t turn your code in quotes. Watch here how it should be
It should be like:
STATICFILES_DIRS = (
os.path.join(os.path.dirname(__file__), "static")
)
Also it belongs to your MEDIA_ROOT
and STATIC_ROOT
settings.
4👍
@chris
STATIC_ROOT and MEDIA_ROOTS are absolute paths and they cannot be tuples so no “,”(commas) is allowed,
So mention the absolute path as “/your/static/file/absolute/path”
Hope this will help 🙂
- Add context to every Django Admin page
- Django, register user with first name and last name?
- Failed to start gunicorn.service: Unit gunicorn.service not found
- ValidationError while using ModelForm Django
- Override data validation on one django form element
3👍
STATIC_ROOT = os.path.join(BASE_DIR, "static_in_pro","static_root"),
Please Remove the comma at end of Static root
STATIC_ROOT = os.path.join(BASE_DIR, "static_in_pro","static_root")
- How to convert request.user into a proxy auth.User class?
- Docker, web app static files. Best practices?
2👍
Summary
If you’re new to Django (like I am) and run into this issue, I recommend looking over the book Two Scoops of Django’s, in particular they have a GitHub template with a good app layout here. In particular, you want to look at:
- Their ‘base.py‘ file under settings, which has all of the configurations for ‘STATIC_ROOT’, ‘MEDIA_ROOT’, etc.
- See how their settings matches their folder structure (see below)
Octotree (Optional)
As a side note, if you use GitHub as source control, I highly recommend getting this Chrome extension called Octotree available here. This lets you view the folder layout of any GitHub repository.
- How can I send signals from within Django migrations?
- Is DateTimeField with auto_now_add option enabled must has value in fixtures