WebFaction
Community site: login faq

I have a simple django project created, as well as a static-only application to host the static files. That static-only application works fine at http://example.com/static/polls/style.css

The problem is that I don't want to host all of my files inside that static application. Ideally, these app-specific styles should live inside the django directory at /home/user/webapps/djangoapp/project/polls/static

Otherwise, whenever I add a new app or module, I have to manually copy over all the static to /home/user/webapps/static

Is there a solution? My current settings.py:

MEDIA_ROOT = '/home/user/webapps/static/'
STATIC_ROOT = '/home/user/webapps/images/'
STATIC_URL = '/static/'
STATICFILES_FINDERS = ("django.contrib.staticfiles.finders.FileSystemFinder",
 "django.contrib.staticfiles.finders.AppDirectoriesFinder")

asked 21 Dec '13, 11:26

MyDjangoLear...
112
accept rate: 0%


Unless you build your own solution to serve these files all automatically from their respective application directories this is not possible. It is standard Django practice for production environments to serve static files all from a single location, which is why they provide the collectstatic tool with manage.py.

For more information on deploying static files with Django please see this link.

permanent link

answered 21 Dec '13, 17:14

waynek
4254
accept rate: 27%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×908
×125
×62

question asked: 21 Dec '13, 11:26

question was seen: 1,941 times

last updated: 21 Dec '13, 17:14

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM