Django 2.2.6 fails to serve some static files in Windows 10

2019-10-02 Thread red sky
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.


Re: Django 2.2.6 fails to serve some static files in Windows 10

2019-10-02 Thread Desh Deepak
You need to edit external css link:

Solution:
href="{% static 'css/styles.css' %}"








Regards:
Desh Deepak
+917011101001
deshdeepak...@gmail.com





On Wed, 2 Oct 2019, 21:37 red sky,  wrote:

> 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
> 
> .
>

-- 
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/CAJ0m4xgGtsdnSmGVvniNf__obX3XBqD2p6YPHhYhy3WH8T3z8Q%40mail.gmail.com.


Re: Django 2.2.6 fails to serve some static files in Windows 10

2019-10-02 Thread Ajeet Kumar Gupt
Hi,

Use the below code

href="{% static 'css/styles.css' %}"

On Wed, Oct 2, 2019 at 8:06 PM red sky  wrote:

> 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
> 
> .
>


-- 






*Thanks & Regards*
Ajeet Kumar Gupt
+91-9311232332

-- 
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/CA%2BTqRsu4Mdcirm67q-eBkyYhAGqFaSJb48Kz%3Dnu%3D9SbLm%3Dnq8A%40mail.gmail.com.


Re: Django 2.2.6 fails to serve some static files in Windows 10

2019-10-03 Thread red sky
Thank you, to Ajjet and Desh.

That solution doesn't work.

I keep getting the error: [03/Oct/2019 23:08:39] "GET 
/static/css/styles.css HTTP/1.1" 404 1767

If I request the file "manually" 
(http://127.0.0.1:8000/static/css/styles.css), I still get the error.


El jueves, 3 de octubre de 2019, 7:31:07 (UTC+2), Ajeet Kumar Gupt escribió:
>
> Hi,
>
> Use the below code 
>
> href="{% static 'css/styles.css' %}"  
>
> On Wed, Oct 2, 2019 at 8:06 PM red sky > 
> wrote:
>
>> 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...@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
>>  
>> 
>> .
>>
>
>
> -- 
>
>
>
>
>
>
> *Thanks & Regards*
> Ajeet Kumar Gupt
> +91-9311232332
>

-- 
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/689e9a04-72fe-47ca-a236-7f09059ba1b2%40googlegroups.com.


Re: Django 2.2.6 fails to serve some static files in Windows 10

2019-10-04 Thread red sky
I think this might be a bug.

It renders the static css files if I configure it as

STATIC_URL = 'static/'

and then change my code to href="/static/css/styles.css">

This breaks compatibility with django toolbar, though...

I think this might be a bug.

El jueves, 3 de octubre de 2019, 23:13:19 (UTC+2), red sky escribió:
>
> Thank you, to Ajjet and Desh.
>
> That solution doesn't work.
>
> I keep getting the error: [03/Oct/2019 23:08:39] "GET 
> /static/css/styles.css HTTP/1.1" 404 1767
>
> If I request the file "manually" (
> http://127.0.0.1:8000/static/css/styles.css), I still get the error.
>
>
> El jueves, 3 de octubre de 2019, 7:31:07 (UTC+2), Ajeet Kumar Gupt 
> escribió:
>>
>> Hi,
>>
>> Use the below code 
>>
>> href="{% static 'css/styles.css' %}"  
>>
>> On Wed, Oct 2, 2019 at 8:06 PM red sky  wrote:
>>
>>> 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...@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
>>>  
>>> 
>>> .
>>>
>>
>>
>> -- 
>>
>>
>>
>>
>>
>>
>> *Thanks & Regards*
>> Ajeet Kumar Gupt
>> +91-9311232332
>>
>

-- 
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/b878dd42-3177-4f2a-87af-566957729e49%40googlegroups.com.


Re: Django 2.2.6 fails to serve some static files in Windows 10

2019-10-04 Thread Jani Tiainen
Hi.

It seems that you have mixed some concepts here.

First you rarely need to manually serve static files in development. Django
takes care of that when using runserver.

STATIC_ROOT is location where static files are collected when you run
collectstatic management command. And that command you usually run when
deploying your site to production.

STATIC_URL is absolute path to static assets. With runserver django serves
static files using this url.

In production you usually need to configure your webserver to serve files
from STATIC_ROOT using url defined by STATIC_URL.

Media file serving is a different story and that you have to do yourself
since django doesn't have any default serving for them.

ke 2. lokak. 2019 klo 19.07 red sky  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
> 
> .
>

-- 
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/CAHn91oetF9CMNjSH_zXTccN8oqtLWKj1nf95CVgFmz2WeBvu%2Bg%40mail.gmail.com.


Re: Django 2.2.6 fails to serve some static files in Windows 10

2019-10-04 Thread Jani Tiainen
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  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
> 
> .
>

-- 
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.


Re: Django 2.2.6 fails to serve some static files in Windows 10

2019-10-04 Thread yashwanth .k
Hi, 
once you try with href="/static/css/styles.css">
and discard STATIC_URL completely. Check whether the css is rendered or 
not? If yes, then the static-files of your project are not loaded properly.
If no, then it is definitely a bug in(2.2.6). 
Thank you.

On Friday, October 4, 2019 at 7:15:59 PM UTC+5:30, red sky wrote:
>
> I think this might be a bug.
>
> It renders the static css files if I configure it as
>
> STATIC_URL = 'static/'
>
> and then change my code to href="/static/css/styles.css">
>
> This breaks compatibility with django toolbar, though...
>
> I think this might be a bug.
>
> El jueves, 3 de octubre de 2019, 23:13:19 (UTC+2), red sky escribió:
>>
>> Thank you, to Ajjet and Desh.
>>
>> That solution doesn't work.
>>
>> I keep getting the error: [03/Oct/2019 23:08:39] "GET 
>> /static/css/styles.css HTTP/1.1" 404 1767
>>
>> If I request the file "manually" (
>> http://127.0.0.1:8000/static/css/styles.css), I still get the error.
>>
>>
>> El jueves, 3 de octubre de 2019, 7:31:07 (UTC+2), Ajeet Kumar Gupt 
>> escribió:
>>>
>>> Hi,
>>>
>>> Use the below code 
>>>
>>> href="{% static 'css/styles.css' %}"  
>>>
>>> On Wed, Oct 2, 2019 at 8:06 PM red sky  wrote:
>>>
 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...@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
  
 
 .

>>>
>>>
>>> -- 
>>>
>>>
>>>
>>>
>>>
>>>
>>> *Thanks & Regards*
>>> Ajeet Kumar Gupt
>>> +91-9311232332
>>>
>>

-- 
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/cb48ea49-222a-4348-840b-20ef828250b0%40googlegroups.com.


Re: Django 2.2.6 fails to serve some static files in Windows 10

2019-10-04 Thread A B
This problem also happens in Linux, with exactly the same symptoms. A
workaround has been found! It works when the file is in the proper
staticfiles folder and not inside a subdirectory.
If I add "styles.css" to the directories:
*STATICFILES_DIRS = [os.path.join(BASE_DIR, 'css').replace("\\", "/")]*
and then I execute manage.py collectstatic the file is collected and placed
on the \static\ directory.
The path that works is http://127.0.0.1:8000/static/styles.cs
s, and I have changed the
template accordingly ({% static "styles.css" %}. There are not 404 errors
anymore.

It seems staticfiles app doesn't like directories for static files (they do
work with apps, like django_toolbar). I have not tried to collect the file
within another different directory.

Regarding the proposed solution:

>discard STATIC_URL completely

it gives me an error, STATIC_URL seems to be required.

  Thank you.


Libre
de virus. www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

El vie., 4 oct. 2019 a las 16:34, yashwanth .k ()
escribió:

> Hi,
> once you try with href="/static/css/styles.css">
> and discard STATIC_URL completely. Check whether the css is rendered or
> not? If yes, then the static-files of your project are not loaded properly.
> If no, then it is definitely a bug in(2.2.6).
> Thank you.
>
> On Friday, October 4, 2019 at 7:15:59 PM UTC+5:30, red sky wrote:
>>
>> I think this might be a bug.
>>
>> It renders the static css files if I configure it as
>>
>> STATIC_URL = 'static/'
>>
>> and then change my code to href="/static/css/styles.css">
>>
>> This breaks compatibility with django toolbar, though...
>>
>> I think this might be a bug.
>>
>> El jueves, 3 de octubre de 2019, 23:13:19 (UTC+2), red sky escribió:
>>>
>>> Thank you, to Ajjet and Desh.
>>>
>>> That solution doesn't work.
>>>
>>> I keep getting the error: [03/Oct/2019 23:08:39] "GET
>>> /static/css/styles.css HTTP/1.1" 404 1767
>>>
>>> If I request the file "manually" (
>>> http://127.0.0.1:8000/static/css/styles.css), I still get the error.
>>>
>>>
>>> El jueves, 3 de octubre de 2019, 7:31:07 (UTC+2), Ajeet Kumar Gupt
>>> escribió:

 Hi,

 Use the below code

 href="{% static 'css/styles.css' %}"

 On Wed, Oct 2, 2019 at 8:06 PM red sky  wrote:

> 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