• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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