Using static from /static folder from uwsgi when DEBUG is False

I have uwsgi and django.

Now I want to use uwsgi without nginx

So,I would like to use static from uwsgi even when DEBUG is false.

My static setting is like this ,and

STATIC_ROOT = 'static'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
    os.path.join(BASE_DIR,'frontend/dist'),
)

pytohn manage.py collectstatic.

Every static files are gathered under static folder.

Then I tryied some options to start uwsgi.

uwsgi --http :8008 --module myapp.wsgi --process=1 

uwsgi --http :8008 --module myapp.wsgi --process=1 --check-static=/static

uwsgi --http :8008 --module myapp.wsgi --process=1 --static-map=/static

However I can't load the images under static folder.

such as

https://www.myapp.com/static/defapp/test.img

There is a image under /static/defapp/test.img.

How can I fix this?

put this path for static

import os
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

insted of

STATICFILES_DIRS = (
    os.path.join(BASE_DIR,'frontend/dist'),
)
Back to Top