Saturday, September 28, 2013

Re: Static files configuration

Thanks Tom,
I had a pretty painful install experience over a few weeks and had sudo'd a command I shouldn't have when doing the GAE install. 
After that experience i'd thought it'd be a pain to sort it out but i've just chown'd the project directory and the /tmp/dev_appserver.searchindexes (after making a backup) and its fine.

Also your right I have recently added django.contrib.staticfiles to my INSTALLED_APPS list, so that may well be it.

So i'm able to start the dev server as a standard user now and have my static content for my project served from [project]/templates/static/ but managed to break the admin css in the process.

INFO:root:"GET / HTTP/1.1" 200 -
INFO:root:"GET /static/css/base.css HTTP/1.1" 200 -
INFO:root:"GET /static/img/MainBanner.png HTTP/1.1" 200 -
INFO:root:"GET /admin HTTP/1.1" 301 -
INFO:root:"GET /admin/ HTTP/1.1" 200 -
INFO:root:"GET /admin/css/base.css HTTP/1.1" 404 -
INFO:root:"GET /admin/css/dashboard.css HTTP/1.1" 404 -
INFO:root:"GET /admin HTTP/1.1" 301 -
INFO:root:"GET /admin/ HTTP/1.1" 200 -
INFO:root:"GET /admin/css/base.css HTTP/1.1" 404 -
INFO:root:"GET /admin/css/dashboard.css HTTP/1.1" 404 -

I've put the base.css file everywhere in the hopes of finding a location that the admin module will pick it up from, but have just made a mess.... can you advise where I should expect the admin module to pick up it's CSS? 
Once i've gotten the admin CSS working and confirmed the dev site's static content is still working, i'll clean all of the directories with CSS that aren't needed in the myapp directory and can start trying to make something!

./django-1.4/django/contrib/admin/static/admin/admin/css/base.css
./django-1.4/django/contrib/admin/static/admin/css/base.css
./myapp/admin/admin/css/base.css
./myapp/admin/css/base.css
./myapp/templates/admin/css/base.css
./myapp/templates/static/css/base.css
./myapp/blogtut/static/css/base.css
./myapp/css/base.css
./myapp/static/admin/admin/css/base.css
./myapp/static/admin/css/base.css
./myapp/static/css/base.css
./django-testapp/admin/admin/admin/css/base.css
./django-testapp/templates/admin/admin/css/base.css




On Saturday, 28 September 2013 13:03:07 UTC-10, Thomas wrote:

On 2013-09-28, at 3:27 PM, Jason S <ser...@gmail.com> wrote:

> I can now access my CSS file and i've confirmed it's location by changing its name and confirming the dev server can't see it any more.after I change the file name.
>
> The directory its finding it is under [project]/templates/static/css
> Sorry, no idea why its working but I suspect its permissions based as i'm running udo python manage.py runserver 0.0.0.0:8080
> I think the dev server is only accessing files owned by root? It doesn't sound right though.

Is there another reason you are running as root? I've been doing all development with my normal user account and have seen no issues at all. If you do have permissions problems those should go away if everything is owned by you rather than root.

And you may have enabled django.contrib.staticfiles in your INSTALLED_APPS. I think that helps to find files when you are running the development server. There is a nice chapter in the Django docs on serving static files.

hth

                    - Tom



--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment