Ask Your Question

askbot running without pictures and js

asked 2017-02-08 10:00:57 -0600

rosettas gravatar image

updated 2017-02-24 11:36:09 -0600

the askbot is running with uwsgi.

while the askbot run with python runserver, it is working fine.

but while it run from uwsgi, the all pictures and js lost.

seems the pictures and js location is like: <script type="text/javascript" src="/m/default/media/jslib/timeago.js?v=1"></script>.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-02-11 09:08:07 -0600

Evgeny gravatar image

updated 2017-02-11 09:09:20 -0600

Configure your web server to serve static files. For example, in nginx:

location /m/ { # url should be the same as STATIC_URL in in this case it's /m/
    alias /path/to/static/files/; #path should be the same as STATIC_ROOT in
    autoindex off;
    expires 30d;
edit flag offensive delete link more


Thanks! But I am still curious why " runserver" could handle the /m/ but uwsgi could not? And what is the reason to have /m/ instead of static which is the real folder name?

rosettas gravatar imagerosettas ( 2017-02-12 14:54:13 -0600 )edit

Because in production it's a lot more efficient to serve static files by a web-server such as nginx, rather than by a Python program. The `runserver` is meant only for the development and testing, so it should be serving from the media directories. The /m/ `STATIC_URL prefix can be replaced with anything else. Short url saves on bandwidth, even though a tiny bit.

Evgeny gravatar imageEvgeny ( 2017-02-12 17:08:01 -0600 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2017-02-08 10:00:57 -0600

Seen: 40 times

Last updated: Feb 11