A
A
Alan Chernov2017-05-09 18:52:30
Django
Alan Chernov, 2017-05-09 18:52:30

How to set gunicorn to show django admin?

Made the settings as indicated in this instruction https://www.8host.com/blog/razrabotka-django-prilo...
Stuck at this point:
"Note: Since Gunicorn does not know where the static content for the admin interface is located, the interface will be displayed without styling.
To pass a module to the Gunicorn server, you need to specify the path to the directory of the wsgi.py file, which is the entry point to the application. Inside this file is the application function, which is used to communicate with the application."
And in general, after all these settings, the admin panel is not shown (

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
devel787, 2017-05-11
@devel787

https://www.digitalocean.com/community/tags/django...

N
Nikita Chukov, 2017-05-27
@chukov

Make settings.py like this:

STATIC_URL = '/django/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "static")

STATICFILES_DIRS = (
    os.path.join(BASE_DIR,"main", "static"),
)

nginx.conf:
location /django/static/ {
  alias /srv/webapp/django-test/current/source/static/;
  autoindex on;
}

Then:
manage.py collectstatic
This command will collect all statics from applications according to settings.py (in my example /static), and nginx will return the statics to url /django/static/.
You can read here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question