Thursday, May 11, 2017

Re: trouble with setting static for img and css

Hello,

Hopefully these drawings of mine can help.

How Django static files work in production

If you have trouble understanding STATIC_ROOT, STATIC_URL, collectstatic, and the web server's configuration, it's because some things are better said with pictures than with text. Here are the pictures.

https://djangodeployment.com/2016/11/21/how-django-static-files-work-in-production/

Regards,

A.

Antonis Christofides  http://djangodeployment.com

On 05/11/2017 03:28 PM, johnf wrote:
Hi folks,

I have researched this issue and I know all I have to do is read the doc's.  But I can seem to get the correct path working to allow the website to find the correct files in my Media,CSS and JS folders.

I'm using 1.11.x and have the following setup in OS file system.

I have set DEBUG = True

/z/pes_django1.11/pesweb/  is where my manage.py is located - it runs just fine.

my files are in

/z/pes_django1.11/pesweb/static/static/css/  - this of course is for CSS

/z/pes_django1.11/pesweb/static/static/js/  -this of course is for JS

/z/pes_django1.11/pesweb/static/static/img/ -this of course is for images like favicon.ico

In my settings.py file I have tried many combinations such as:

STATIC_URL = '/pesweb/static/static/'

STATIC_URL = '/static/static/'

STATIC_URL = '/pesweb/static/'


So would some kind soul please tell me what I need in STATIC_URL, and MEDIA_URL.

Thanks in advance,

Johnf




No comments:

Post a Comment