Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

398
Views
Deploying a Django Application (Apache, Passenger, Virtualenv)

Im stuck in deploying my working Django Application on a production PLESK server. The project can be started as a development server successfully by typing:

httpdocs# cd mysite
httpdocs/mysite# source myvenv/bin/activate
httpdocs/mysite# export LD_LIBRARY_PATH="/usr/local/lib"
httpdocs/mysite# python manage.py runserver <freyt.de>:8000

Then, if I point the browser to freyt.de:8000 I can see my app. Fine. Right now, I'm trying to call my app by Passenger from Apache. When checking with "passenger-config restart-app" it seems to run, but when curl freyt.de it shows me html with 403 Forbidden. So, I assume my Django app is not started successfully.

This is my current folder structure:

Folder structure

I already adjusted some topics in PLESK as follows:

  • Apache Webserver: wsgi is activated

  • I created a Service Plan and subscribed it with my domain freyt.de

  • In the Service Plan under tab "Webserver" I added additional directives for HTTP as follows.

PassengerEnabled On
PassengerAppType wsgi
PassengerStartupFile passenger_wsgi.py
  • In the Service Plan under "Hosting Parameters" I enabled SSH access to the server shell: /bin/bash

  • For the "Domain" I set the Document root to "..httpdocs/public". Also I added in "Apache & nginx Settings" the same directives. (I also tried without, but dont seem to have an effect.)

Some details at Document Root:

  • I added .htaccess in public with again same directives (just for testing). No other files in public.

  • My passenger_wsgi.py contains, which seems to be ok:

import sys, os
cwd = os.getcwd()
sys.path.append(cwd)
sys.path.append(cwd + '/mysite')

if sys.version < "2.7.9":
  os.execl(cwd + "/mysite/myvenv/bin/python", "python3.6", *sys.argv)

sys.path.insert(0, cwd + '/mysite/myvenv/bin')
sys.path.insert(0, cwd + '/mysite/myvenv/lib/python3.6')
#sys.path.insert(0, cwd + '/mysite/myvenv/lib/python3.6/site-packages/django')
sys.path.insert(0, cwd + '/mysite/myvenv/lib/python3.6/site-packages')

os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings"
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
  • The file mysite/mysite/wsgi.py is untouched:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
application = get_wsgi_application()

Would be great, if someone could point me in the correct direction. I think its just a small mistake somewhere :-) Thanks in advance.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!