Sujet : Django Deployment

Hello!

I have some problems with Django deployment.

I tried to deploy a 'hello world' application which works fine on a local server, but not on production.


Here is my project structure:
wmexch/
   __init__.py
   manage.py
   settings.py
   urls.py
   views.py
   public/
      .htaccess
      django.fcgi

Here is my .htaccess file:
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]

And django.fcgi:
------------------------
#!/usr/bin/python
import os, sys

_PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, _PROJECT_DIR)
sys.path.insert(0, os.path.dirname(_PROJECT_DIR))

_PROJECT_NAME = _PROJECT_DIR.split('/')[-1]
os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % _PROJECT_NAME

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
--------------------------

My subdomain lacrima.alwaysdata.net points to      /www/wmexch/public

When I try to access my site http://lacrima.alwaysdata.net/hello/ ,I receive 500 error.

I can't understand what's wrong with my setup. Can you please help me to resolve my problem?

With regards, Max.

2

Re: Django Deployment

Hello,

Your django.fcgi file was in DOS format. It has to be in UNIX format. I changed it (using the 'dos2unix' command), it should work now.

Re: Django Deployment

Cyril a écrit:

Hello,

Your django.fcgi file was in DOS format. It has to be in UNIX format. I changed it (using the 'dos2unix' command), it should work now.

Thank you very much!
Great support!

With regards, Max