• 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

Question Deploy Django 1.10 project running Python 3.5 on Ubuntu 14.04 with Plesk 12

sfat

New Pleskian
I just finished my first Django project and wanted to deploy it to my virtual server running Ubuntu 14.04 64 bit and Plesk 12. At first, I wanted to use Phusion Passenger, as described in https://devblog.plesk.com/2014/10/plesk-and-django/. However, Phusion Passenger doesn't support Python 3. Therefore, I followed the official deployment instructions for WSGI (https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/modwsgi/). Unfortunately, I can't seem to get it up and running. What I did so far:

1) First I installed all the dependencies. Then I created a new subdomain in Plesk (myproject.example.com) and cloned my Git repository directly into the subdomain's root. My Django project uses a virtual environment. The basic folder structure is as follows:
Code:
.
├── app1
├── app2
├── env
├── myproject
└── static

So these folders currently reside in /var/www/vhosts/example.com/myproject.example.com/. As far as I understand, this is bad practice, but I wanted to follow the instructions as closely as possible.

2) Then I created a subdomain-specific Apache configuration file in /var/www/vhosts/system/myproject.example.com/conf/vhost.conf with the following content:
Code:
WSGIScriptAlias / /var/www/vhosts/example.com/myproject.example.com/myproject/wsgi.py
WSGIPythonPath /var/www/vhosts/example.com/myproject.example.com

<Directory /var/www/vhosts/example.com/myproject.example.com/myproject>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

I figured, even if the virtual environment is not yet set up, I should see something. So I restarted the Apache 2.4.7 server and checked http://myproject.example.com/. The response was
Code:
403 Forbidden
You don't have permission to access / on this server.

Clearly, there is something wrong with my setup, but I can't figure out what. The permissions seem fine:
Code:
drwxr-x---     myuser psaserv    myproject.example.com

drwxr-xr-x     myuser psacln     myproject

-rw-r--r--     myuser psacln     wsgi.py

I also tried adding the path to my virtual environment and using mod_wsgi daemon mode, without luck. Can someone please help me?
 
Back
Top