Ask Your Question

Static files (css, js and images) not served

asked 2012-04-29 14:06:59 -0500

kintali's avatar

updated 2012-04-29 14:13:13 -0500

Evgeny's avatar

I checked out askbot code from github using the following command

git clone git://

And ran the following command

python develop

I deployed it on my webserver by following the instructions at When I visit my website it looks like the following Image.

All the css rendering is gone. Am I missing some step ?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2012-04-29 14:12:25 -0500

Evgeny's avatar

updated 2012-04-29 14:13:45 -0500

The issue you are seeing is that static files are not served with DEBUG=False, so the site appears unstyled.

With runserver, please use DEBUG=True, as in production mode static files are not served by django.

Please run python collectstatic - to collect the static files for production and configure your webserver to serve the static resources directly.

edit flag offensive delete link more


I ran python collectstatic. How do I configure to serve static resources directly ?

kintali's avatar kintali  ( 2012-04-29 14:38:13 -0500 )edit

Is DEBUG setting True or False?

Evgeny's avatar Evgeny  ( 2012-04-29 14:39:34 -0500 )edit

Oh, you need to add Alias settings (or equivalent) to your webserver configuration. For Apache you need something like Alias /static/ /path/to/django-project/static/, where the second path will be specific to your setup.

Evgeny's avatar Evgeny  ( 2012-04-29 14:40:31 -0500 )edit

DEBUG=False. I am using the same configuration file mentioned at Is there an issue with permissions ? What permissions are needed for django-project and other directories ?

kintali's avatar kintali  ( 2012-04-29 14:54:02 -0500 )edit

With DEBUG=False you have to serve static files yourself - via the webserver. With DEBUG=True django will serve static files. For production it is very inefficient to serve static files via python (django). It could be that files are inaccessible to the webserver process. It could be for example because one of the directories above the static files being inaccessible to the effective user that runs the webserver process.

Evgeny's avatar Evgeny  ( 2012-04-29 15:04:29 -0500 )edit

answered 2012-04-29 14:41:24 -0500

tristan's avatar

updated 2012-04-29 15:00:27 -0500

Evgeny's avatar

If you are using Apache, in the file, modify STATIC_URL with '/static/' and run python collectstatic.
Then follow

edit flag offensive delete link more


STATIC_URL should be '/static/' - with the leading and the trailing slash.

Evgeny's avatar Evgeny  ( 2012-04-29 14:49:21 -0500 )edit

Yes that right... oops...

tristan's avatar tristan  ( 2012-04-29 14:55:35 -0500 )edit

I have the following settings : MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'askbot', 'upfiles') MEDIA_URL = '/upfiles/' STATIC_URL = '/m/'#this must be different from MEDIA_URL

PROJECT_ROOT = os.path.dirname(__file__) STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')

kintali's avatar kintali  ( 2012-04-29 14:57:13 -0500 )edit

And the virtualhost ?

tristan's avatar tristan  ( 2012-04-29 15:04:26 -0500 )edit

I don't see virtualhost in

kintali's avatar kintali  ( 2012-04-29 15:16:59 -0500 )edit

answered 2014-07-11 02:46:28 -0500

ProfGra's avatar

Another solution is a symlink: from the public dir, where you may have your .htaccess and askbot.fcgi, run:

ln -s /path/to/static m

Of course, you need to run python collectstatic too.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-04-29 14:06:59 -0500

Seen: 3,509 times

Last updated: Jul 11 '14