Also you never put STATIC_ROOT to STATICFILES_DIRS.

Because then you would with collectstatic command copy STATICFILES_DIRS to
STATIC_ROOT...


ke 2. lokak. 2019 klo 19.07 red sky <alfredob...@gmail.com> kirjoitti:

> My system: Windows 10 1903. Python 3.7.4, 64 bit.
>
> My directory structure:
> %USERPROFILE%/Desktop/myproject/manage.py
> %USERPROFILE%/Desktop/myproject/some_app (...)
> %USERPROFILE%/Desktop/myproject/myproject/db.sqlite3
> %USERPROFILE%/Desktop/myproject/myproject/urls.py
> %USERPROFILE%/Desktop/myproject/myproject/static (...)
> %USERPROFILE%/Desktop/myproject/myproject/static/css (...)
> %USERPROFILE%/Desktop/myproject/myproject/media (...)
> %USERPROFILE%/Desktop/myproject/myproject/some_apps (...)
> %USERPROFILE%/Desktop/myproject/myproject/settings/
> %USERPROFILE%/Desktop/myproject/myproject/settings/__init__.py
> %USERPROFILE%/Desktop/myproject/myproject/settings/settings_base.py
> %USERPROFILE%/Desktop/myproject/myproject/settings/settings_devel.py
> %USERPROFILE%/Desktop/myproject/myproject/settings/settings_production.py
>
>
> My urls.py (last part):
> if ENVIRONMENT=="development":
> import debug_toolbar
> urlpatterns += [path('__debug__/',include (debug_toolbar.urls))]
> urlpatterns += static(MEDIA_URL,document_root=MEDIA_ROOT)
> urlpatterns += static(STATIC_URL,document_root=STATIC_ROOT)
> urlpatterns += router.urls
>
> My settings:
>
> STATIC_URL = '/static/'
> STATIC_ROOT = os.path.join(BASE_DIR , 'static')
> MEDIA_ROOT = BASE_DIR + '/media/'
> (...)
> MEDIA_URL='/media/'
>
> I also tried with and without the following setting in several variants:
> STATIFCILES_DIRS = ["","//",STATIC_ROOT,
> "%userprofile%\\Desktop\\myproject\\myproject\\"]
>
> The template: The error happens both with  href="/static/css/styles.css" and
> {% load static %} (...) href="{% static css/styles.css}" . I think the
> template is not the problem here.
>
> The error:"GET /static/css/styles.css HTTP/1.1" 404 1767
>
> The error takes place also with static requests (
> http://127.0.0.1:8000/static/css/styles.css)
>
> Strange behaviour:
> If I change the setting static_url to STATIC_URL = "static/" the css file
> is served. However, debug_toolbar ceases to serve her own static files and
> doesn't work anymore ("GET
> /myproject/static/debug_toolbar/img/ajax-loader.gif HTTP/1.1" 404 14554)
>
> I have tried many things, to no avail.
>
> Thank you.
>
> --
> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/aa231cc0-c3bf-4d3d-8bf0-6578d1952eff%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/aa231cc0-c3bf-4d3d-8bf0-6578d1952eff%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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91od2G_oN57oB_mAE-_%2B_wod30SoUWBTg%2BcXAvkSeaD04Pw%40mail.gmail.com.

Reply via email to