• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Plesk and Django

David Turner

New Pleskian
I have a django project which I am deploying to my server. This is a combination of nginx/apache running on CentOS6.5. The project is running fine in a virtual environment using this combination. My issue is when I come to deploy it, how do I amend the nginx configuration to serve the static files?

Without Plesk I would edit the /ect/nginx/conf.d/"virtualhost" file. However, as I understand it this is not how you do it with Plesk. Any help would be apprecited or any recommendations for alternatives.

Thanks in advance.
 
I apologise for the mistaken comment in thinking you for you previous answer. We decided to go down a different route

I have built a django app which runs in a container using Centos Apache and Nginx. Everything works fine.

On our server we have Centos and Plesk with Apache and Nginx. I have installed Python3.4 whilst maintaining the system python so everything is fine at this stage.

I have then installed pip and django and uploaded the django project. this is running on a sub-domain e.g
var/www/vhosts/mainsite/sub-domain
I have checked that this is working
$uwsgi --http :8000 --module testsite.wsgi
Again everything works fine.
Having read the Plesk documentation I understand that to add directives to the virtual host I have to add them to either:
vhost.conf
vhost_nginx.conf
in the var/www/vhosts/system/testsite
However when I come to add the following which works I get errors such as
“upstream" directive is not allowed here in /var/www/vhosts/system/testsite.vet-connect.co.uk/conf/vhost_nginx.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed”
My directives form my local site on the virtual box server is as follows:
upstream django {
# server unix:///var/www/vhosts/maindomain/subdomain/testsite.socket
}
# configuration of the server
server {
# the port your site will be served on
listen 8000;
# the domain name it will serve for
server_name testsite
charset utf-8;

# max upload size
client_max_body_size 75M; # this is just to test

# Django media

location /static {
alias /var/www/vhosts/mainsite/testsite/djangoapp/static;
}

# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /var/www/vhosts/mainsite/testsite/dajngoapp/uwsgi_params;
}
}

Any help on this would be appreciated.
 
Back
Top