deploying python flask application in apache 24 - python

I have developed a python (python 3.6 32bit) flask application and I need this to be deployed in a windows server with apache24 32bit.
I referred steps in https://medium.com/#madumalt/flask-app-deployment-in-windows-apache-server-mod-wsgi-82e1cfeeb2ed
When I try to launch the httpd.exe in apache24 am getting the below error
[Sun Jun 21 20:36:15.112840 2020] [mpm_winnt:notice] [pid 20600:tid 476] AH00455: Apache/2.4.43 (Win32) mod_wsgi/4.7.1 Python/3.6 configured -- resuming normal operations
[Sun Jun 21 20:36:15.112840 2020] [mpm_winnt:notice] [pid 20600:tid 476] AH00456: Apache Lounge VS16 Server built: Apr 21 2020 16:02:41
[Sun Jun 21 20:36:15.112840 2020] [core:notice] [pid 20600:tid 476] AH00094: Command line: 'httpd.exe -d C:/Apache24'
[Sun Jun 21 20:36:15.123841 2020] [mpm_winnt:notice] [pid 20600:tid 476] AH00418: Parent: Created child process 2064
Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00002dfc (most recent call first):
[Sun Jun 21 20:36:21.808509 2020] [mpm_winnt:crit] [pid 20600:tid 476] AH00419: master_main: create child process failed. Exiting.
Please find the SET configurations below,
OS=Windows_NT
Path=C:\Python36-32\Scripts\;C:\Python36-32\;C:\Program Files\Common Files\Micro
soft Shared\Microsoft Online Services;C:\Program Files (x86)\Common Files\Micros
oft Shared\Microsoft Online Services;C:\ProgramData\Oracle\Java\javapath;C:\Wind
ows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowe
rShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\
PYTHONHOME=C:\Python36-32\
PYTHONPATH=C:\Python36-32\Scripts\

#1 check if you have an OLD python installation and remove it properly (including old environment vars, path ..)
#2 i would recommend you, if possible, upgrading your python installation to the last one 3.8.x +
#3 your problem is very common: your environment variables are NOT correctly set:
go to Advanced tab under System Properties and click Environment Variables
Under System Variables create those variables:
APACHE_HOME = C:\wamp\bin\apache\apache2.4.23 (i'm using WAMPSERVER)
MOD_WSGI_APACHE_ROOTDIR = %APACHE_HOME% (since you are using mod_wsgi, check official doc on pypi)
PYTHON_HOME = C:\Python37 (it depends on your python installation)
go to User variables and add/append variables to PATH like so:
PATH = %APACHE_HOME%\bin;%MOD_WSGI_APACHE_ROOTDIR%;%PYTHON_HOME%;%PYTHON_HOME%\Scripts;
#4 open new console and check your python installation:
python --version
#5 create a simple flask app to make sure everything is working as expected
py -m flask run
#6 to deploy the app on Apache server, have look at this flask doc and the official mod_wsgi doc
you have to install mod_wsgi GLOBALLY, meaning you have to deactivate first your virtual environment of your current active application.
(venv) C:\myapps\flask\helloflask>deactivate (i'm using venv the standard and default python virtual environment py -m venv venv)
C:\myapps\flask\helloflask>pip install mod_wsgi
C:\myapps\flask\helloflask>pip list
#7 configure mod_wsgi in Apache Server
check if mod_wsgi is correctly installed and configured
C:\myapps\flask\helloflask>mod_wsgi-express --help
Usage: mod_wsgi-express command [params]
Commands:
module-config
module-location
mod_wsgi-express: error: Invalid command was specified.
run this command:
mod_wsgi-express module-config
the output of the command should be like the following (depending on your system and python installation):
WSGIPythonHome "c:/python37"
LoadFile "c:/python37/python37.dll"
loadmodule wsgi_module "c:/python37/lib/site-packages/mod_wsgi/server/mod_wsgi.cp37-win32.pyd"
Copy the output of the above command and paste it in C:\wamp\bin\apache\apache2.4.23\conf. To make things consistent, locate the section where Modules are listed and add it at the very end of the list.
#8 create wsgi.py under the root of your project and paste the code (it's self-explanatory)
import os
import sys
# activate virtualenv
PROJECT = "helloflask"
# i'm using py -m venv venv
# #see: https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html
# #see: https://stackoverflow.com/questions/25020451/no-activate-this-py-file-in-venv-pyvenv
activate_this = os.path.join('C:/myapps/flask', PROJECT, 'venv/Scripts/activate_this.py')
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
BASE_DIR = os.path.join(os.path.dirname(__file__))
if BASE_DIR not in sys.path:
sys.path.append(BASE_DIR)
from helloflask import create_app
application = create_app()
#9 Configure a Virtual Host for the Flask App
<VirtualHost *:80>
ServerName helloflask.local
DocumentRoot "C:/myapps/flask/helloflask"
WSGIScriptAlias / "C:/myapps/flask/helloflask/wsgi.py"
<Directory "C:/myapps/flask/helloflask">
Require all granted
</Directory>
# app = Flask(
# __name__,
# static_url_path='/public/static',
# static_folder='static'
# )
# Alias /public/static "C:/myapps/flask/helloflask/public/static"
# <Directory "C:/myapps/flask/helloflask/public/static">
# Require all granted
# </Directory>
ErrorLog "C:/wamp/logs/helloflask.error.log"
CustomLog "C:/wamp/logs/helloflask.access.log" common
</VirtualHost>
#10 check your Apache configuration
httpd -t
if it's OK, restart your Apache server

Related

Django Apache error: No module named 'encodings'. Windows server 2008 R2 Standard

I clone repo from git. I create venv:
python -m venv myenv
/myenv/scripts/activate.bat
pip install -r requirements.txt
pip install mod_wsgi-4.6.5+ap24vc14-cp36-cp36m-win_amd64.whl
if i run from myvenv that:
python manage.py runserver
it's work!
if I run from apache, I have a error:
[Wed Oct 30 10:51:18.732028 2019] [mpm_winnt:notice] [pid 352:tid 168] AH00455: Apache/2.4.41 (Win64) mod_wsgi/4.6.5 Python/3.6 configured -- resuming normal operations
[Wed Oct 30 10:51:18.732028 2019] [mpm_winnt:notice] [pid 352:tid 168] AH00456: Apache Lounge VS16 Server built: Aug 9 2019 16:46:32
[Wed Oct 30 10:51:18.732028 2019] [core:notice] [pid 352:tid 168] AH00094: Command line: 'httpd -d C:/Apache24'
[Wed Oct 30 10:51:18.732028 2019] [mpm_winnt:notice] [pid 352:tid 168] AH00418: Parent: Created child process 1748
Fatal Python error: Py_Initialize: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00000354 (most recent call first):
[Wed Oct 30 10:51:23.677228 2019] [mpm_winnt:crit] [pid 352:tid 168] AH00419: master_main: create child process failed. Exiting.
below httpd.conf:
LoadFile "c:/<>/python/python36/python36.dll"
LoadModule wsgi_module "c:/envs/myproject/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIScriptAlias / "c:/<myproject>/wsgi.py"
WSGIPythonHome "c:/envs/myproject"
WSGIPythonPath "c:/<myproject>"
Alias /static/ "c:/<myproject>/static/"
<Directory "c:/<myproject>/static">
Require all granted
</Directory>
<Directory c:/<myproject>>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
<Directory c:/<myproject>/attachments>
Require all granted
</Directory>
I set PYTHONHOME and PYTHONPATH as "C:\Users\user\AppData\Local\Programs\Python\Python36;C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts"
I looked many question, example: Fatal Python error on Windows 10 ModuleNotFoundError: No module named 'encodings'
but this error only in apache.
Your config file seems to have no issue.
I had a similar issue, how I solved it was,
I checked my Apache24 installation , it was 32-bit, while my python install was a 64-bit, so I had to reinstall the Apache24 64 bit version and put the configuration in httpd.conf again.
I also had to install my python in the main C directory instead of instead of inside the \Users so my base python location was C:\Python36, and include the C:\Python36\ and C:\Python36\Scripts\ inside the path of the system variables then create a new virtualenv and include in the Apache configuration
Fortunately, I have done it.
I used "virtualenvwrapper" for Windows. It's really helpful.
pip install virtualenvwrapper-win
mkvirtualenv myenv
pip install -r requirements.txt
pip install mod_wsgi-4.6.5+ap24vc14-cp36-cp36m-win_amd64.whl
It's work.
The issue is that Apache on Windows, when run as a Service does not pick up the PYTHONHOME environment variable which it needs for the right Python installation to be used.
If it doesn't find it, it gives a very misleading error about the encdongs module not found
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
To get it to work, in a Windows Terminal or CMD, run Apache as a standard executable - not as a Service:
set PYTHONHOME=<root-of-python-or-conda-env>
httpd // In this case, Apache server picks up PYTHONHOME and comes up
httpd -k start // as a service (need to be admin) - here it DOES NOT pick up PYTHONHOME and fails with the error above
Also note, per the mod_wsgi author, on Windows, Apache seems to ignore the WSGIPythonHome directive, so don't bother going down that rabbit hole.
Ensure you have the PYTHONHOME environment variable

mod_wsgi: Unable to stat Python home and ImportError: No module named 'encodings'

I am trying to construct a web site on Apache 2.4 using Django and mod_wsgi on Python 3.5.2. But when apache daemon httpd is started, following error message is output on /var/log/httpd/error_log.
[Fri Sep 16 17:44:57.145900 2016] [wsgi:warn] [pid 20593] (13)Permission denied: mod_wsgi (pid=20593): Unable to stat Python home /home/ec2-user/.pyenv/versions/3.5.2. Python interpreter may not be able to be initialized correctly. Verify the supplied path and access permissions for whole of the path.
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
So, I explored some articles about similar problems, e.g.
Django + Apache + mod_wsgi permission denied
mod_wsgi: ImportError: No module named 'encodings'
but the causes of error message above are not yet resolved.
Please indicate some points to be checked or documents to read and so on.
My development environments are as follows.
(1) Host and OS
Hosting Service: Amazon AWS EC2
OS: Amazon Linux AMI release 2016.03
(2) Django Project
I made Django project named testprj in the directory /home/ec2-user/django-sites with user account of ec2-user.
[ec2-user#MyEC2 django-sites]$ pwd
/home/ec2-user/django-sites
[ec2-user#MyEC2 django-sites]$ ls -l
total 4
drwxrwxr-x 3 ec2-user ec2-user 4096 Sep 16 14:50 testprj
Database which the testprj uses is already set up. So, development server provided in Django is successfully started with no error as bellow.
[ec2-user#MyEC2 testprj]$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
September 16, 2016 - 14:23:47
Django version 1.10.1, using settings 'testprj.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
(3) Environments of Python
I installed Python 3.5.2 by pyenv install 3.5.2. And then I set
pyenv virtualenv 3.5.2 django-sites.
And I set local of /home/ec2-user/django-sites to env django-sites as bellow.
[ec2-user#MyEC2 django-sites]$ pwd
/home/ec2-user/django-sites
[ec2-user#MyEC2 django-sites]$ pyenv versions
system
3.5.2
3.5.2/envs/django-sites
* django-sites (set by /home/ec2-user/django-sites/.python-version)
[ec2-user#MyEC2 django-sites]$ python -V
Python 3.5.2
And I installed following modules through pip command.
[ec2-user#MyEC2 django-sites]$ pwd
/home/ec2-user/django-sites
[ec2-user#MyEC2 django-sites]$ pip list
configparser (3.5.0)
Django (1.10.1)
mod-wsgi (4.5.7)
pip (8.1.2)
PyMySQL (0.7.9)
setuptools (27.2.0)
(4) Web server
Web server which I use is Apache 2.4 as bellow.
[ec2-user#MyEC2 ~]$ httpd -v
Server version: Apache/2.4.23 (Amazon)
Server built: Jul 29 2016 21:42:17
User and Group of executing Apache are both apache as next lines in /etc/httpd/conf/httpd.conf.
User apache
Group apache
(5) Additinal conf file for the Django project testprj
I intend to configure such that the URL
http://[MyEC2 domain]/testprj/
can access a top page of Django project located at /home/ec2-user/django-sites/testprj.
[MyEC2 domain] above is like
ec2-XX-XX-XX-XX.us-west-2.compute.amazonaws.com
So, I wrote testprj.conf in /etc/httpd/conf.d as bellow.
[ec2-user#MyEC2 conf.d]$ pwd
/etc/httpd/conf.d
[ec2-user#MyEC2 conf.d]$ cat -n testprj.conf
1 LoadModule wsgi_module /home/ec2-user/.pyenv/versions/django-sites/lib/python3.5/site-packages/mod_wsgi/server/mod_wsgi-py35.cpython-35m-x86_64-linux-gnu.so
2
3 WSGIPythonHome /home/ec2-user/.pyenv/versions/3.5.2
4 WSGIScriptReloading On
5 WSGIScriptAlias /testprj/ /home/ec2-user/django-sites/testprj/testprj/wsgi.py
6 WSGIPythonPath /home/ec2-user/django-sites/testprj:/home/ec2-user/.pyenv/versions/django-sites/lib/python3.5/site-packages
7
8 <VirtualHost *:80>
9
10 ServerName http://ec2-XX-XX-XX-XX.us-west-2.compute.amazonaws.com
11 SuexecUserGroup apache apache
12
13 <Directory /home/ec2-user/django-sites/testprj/testprj>
14 <Files wsgi.py>
15 Require all granted
16 </Files>
17 </Directory>
18
19 Alias /static/ "/home/ec2-user/django-sites/testprj/static/"
20
21 <Directory /home/ec2-user/django-sites/testprj/static>
22 <Files *>
23 Require all granted
24 </Files>
25 </Directory>
26
27 </VirtualHost>
28
[ec2-user#MyEC2 conf.d]$
Best regards.
A couple of things to check.
The pyenv tool doesn't install Python with a shared library by default. That could result in problems as mod_wsgi wants a shared library. You need to explicitly tell pyenv to build Python with a shared library.
A home directory on many Linux systems is not readable to other users. When mod_wsgi is being initialised, it is running as the Apache user and will not be able to see inside of the home directory. There isn't an issue when the mod_wsgi module is loaded by Apache as Apache is running as root at that point.
There are other issues with your configuration where don't follow best practices, but the above, especially the second item is likely the cause of your problem.

My python in virtual-env is 2.7 but the Django debug screen shows the system's 2.6.6

So inside of my virtual env, if I activate it and type python, version 2.7 is opened, as it should.
When an error arises in Django, it shows version 2.6 which is the system default. Here is what my Apache configuration looks like:
<VirtualHost *:80>
ServerName www.mysite.com
ErrorLog /var/www/virtualenv-2.7/django-error-log
Alias /static/ /var/www/virtualenv-2.7/mysite/mainapp/static/
WSGIDaemonProcess mysite python-path=/var/www/virtualenv-2.7/mysite:/var/www/virtualenv-2.7/lib/python2.7/site-packages
WSGIProcessGroup mysite
WSGIScriptAlias / /var/www/virtualenv-2.7/mysite/mysite/wsgi.py
<Directory /var/www/virtualenv-2.7>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
WSGISocketPrefix /var/run/wsgi
WSGIPythonPath /var/www/virtualenv-2.7/mysite:var/www/virutalenv-2.7/lib/python2.7/site-packages
My wsgi.py:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
When I service httpd restart, this is what is put in the apache error logs:
[Mon Jan 19 20:19:03 2015] [notice] caught SIGTERM, shutting down
[Mon Jan 19 20:19:04 2015] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Mon Jan 19 20:19:04 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Jan 19 20:19:04 2015] [notice] Digest: generating secret for digest authentication ...
[Mon Jan 19 20:19:04 2015] [notice] Digest: done
[Mon Jan 19 20:19:04 2015] [notice] Apache/2.2.15 (Unix) DAV/2 mod_wsgi/3.2 Python/2.6.6 configured -- resuming normal operations
Any idea why Django does not use 2.7 found in the virtual env?
The mod_wsgi module is compiled against the system version of Python; the clue is in the startup message:
mod_wsgi library version
vvvvvvvvvvvv
Apache/2.2.15 (Unix) DAV/2 mod_wsgi/3.2 Python/2.6.6 configured
^^^^^^^^^^^^
Python version
To fix this, you can either compile mod_wsgi against the version of Python you need, or use the WSGIPythonHome configuration directive:
Used to indicate to Python when it is initialised where its library
files are installed. This should be defined where the Python
executable is not in the PATH of the user that Apache runs as, or
where a system has multiple versions of Python installed in different
locations in the file system, especially different installations of
the same major/minor version, and the installation that Apache finds
in its PATH is not the desired one.
This directive can also be used to indicate a Python virtual
environment created using a tool such as virtualenv, to be used for
the whole of mod_wsgi.
In your Apache configuration, add the following and then reload the server:
WSGIPythonHome /var/www/virtualenv-2.7/lib/python2.7

Apache mod_wsgi throwing error "403 Forbidden" when deploying a Django project

I have been trying to deploy a Django site using mod_wsgi on a CentOS server recently, but so far when I try to access the django site through my laptop, the web page has only been displaying error: 403 Forbidden You don't have permission to access / on this server.
In addition to reading all the obvious documentation, I have looked at these previous questions:
Django + mod_wsgi + Apache = 403 Forbidden
Error message “Forbidden You don't have permission to access / on this server”
Forbidden You don't have permission to access / on this server
Apache mod_wsgi error: Forbidden You don't have permission to access / on this server
Django on apache wtih mod_wsgi (Linux) - 403 Forbidden
Environment:
Centos 6.5
Python 2.6
Django 1.6
I am running the following version of apache:
# apachectl -V
Server version: Apache/2.2.15 (Unix)
Server built: Apr 3 2014 23:56:16
Server's Module Magic Number: 20051115:25
Server loaded: APR 1.3.9, APR-Util 1.3.9
Compiled using: APR 1.3.9, APR-Util 1.3.9
Architecture: 64-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)
I installed mod_wsgi using Yum and have confirmed it is installed on the server:
# httpd -M | grep wsgi
wsgi_module (shared)
Syntax OK
My httpd.conf wsgi config snippet is as follows:
#
# Add WSGI configuration
#
WSGIScriptAlias / /usr/local/django/basic/basic/apache/wsgi.py
WSGIPythonPath /usr/local/django/basic/
WSGIDaemonProcess ###.###.###.###
WSGIProcessGroup ###.###.###.###
<Directory /usr/local/django/basic/basic/apache>
<Files wsgi.py>
Options FollowSymLinks
Order deny,allow
Allow from all
</Files>
</Directory>
Finally my wsgi.py script is:
"""
WSGI config for basic project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
import sys
path = "/usr/local/django/basic/basic/apache"
if path not in sys.path:
sys.path.append(path)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "basic.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Output from error log:
[Fri Oct 24 14:10:43 2014] [error] [client (redacted)] Symbolic link not allowed or link target not accessible: /usr/local/django/basic
[Fri Oct 24 14:11:25 2014] [error] [client (redacted)] Symbolic link not allowed or link target not accessible: /usr/local/django/basic
[Fri Oct 24 14:14:02 2014] [error] [client (redacted)] Symbolic link not allowed or link target not accessible: /usr/local/django/basic
Notes:
The django project is in my user's home directory but has a symbolic link in `/usr/local/django/ pointing to it
In the past when I have worked on projects Error 403 usually meant that the permissions on a file were wrong, but I had check that and the files should all allow the apache user to access them
My web server works fine when I comment out the wsgi related lines of the Apache config.
Sorry, that I posted this a bit late. This was the final fix to my apache config that ultimately worked.
WSGIScriptAlias /basic /var/www/django/basic/basic/wsgi.py
WSGIPythonPath /var/www/django/basic/
<Directory /var/www/django/basic/basic>
Options FollowSymLinks
<Files wsgi.py>
Order allow,deny
Allow from all
</Files>
</Directory>
Alias /static /var/www/django/basic/basic/static
And this is the final version of my wsgi.py file in python. The key line of code here was the PYTHON_EGG_CACHE. That variable was by default set to a directory that did not exist. I set it to /tmp/.python-eggs Make sure that .python-eggs has correct permissions for the apache user to read/write to it wherever you may place this file.
"""
WSGI config for basic project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
import sys
path = "/usr/local/django/basic/basic/apache"
if path not in sys.path:
sys.path.append(path)
os.environ['PYTHON_EGG_CACHE'] = '/tmp/.python-eggs'
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "basic.settings")
#print os.getenv("DJANGO_SETTINGS_MODULE")
#print os.getenv("PYTHON_EGG_CACHE")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Side note:
A friendly reminder to make sure that every file in your django application is readable, (and writeable if needed) by the apache user. Git once overwrote a file to an old permission I had set up once and it took me a little time to figure out the permissions had changed without realizing it.
May be you forget set DocumentRoot. You should make the DocumentRoot can be read and wrote by apache users.
just do like this:
sudo chown -R www_default:www_default /path/to/you/DocumentRoot
and you can also do like this :
sudo chmod -R 755 /path/to/your/DocumentRoot

Mod_wsgi syntax error: "Invalid command import"

i'm trying to setup mod_wsgi to serve my django media files (i want to use this also in a developement env)
I followed this guide to correctly setup mod_wsgi.
This is my wsgi file ("django.wsgi")
import os, sys
path = '/home/smau/Workspace/Maynard/tothego_frontend/'
if path not in sys.path:
sys.path.append(path)
#Calculate the path based on the location of the WSGI script.
apache_configuration= os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)
os.environ['DJANGO_SETTINGS_MODULE'] = 'tothego_frontend.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
This is my conf file ("django.conf")
Alias /site_media/ "/home/smau/Workspace/Maynard/tothego_frontend/site_media/"
<Directory "/home/smau/Workspace/Maynard/tothego_frontend/site_media">
Order allow,deny
Options Indexes
Allow from all
IndexOptions FancyIndexing
</Directory>
WSGIScriptAlias / "/home/smau/Workspace/Maynard/tothego_frontend/srv/mod_wsgi/django.wsgi"
<Directory "/home/smau/Workspace/Maynard/tothego_frontend/srv/mod_wsgi">
Allow from all
</Directory>
This is my "httpd.conf"
Include /home/smau/Workspace/Maynard/tothego_frontend/srv/mod_wsgi/django.wsgi
Everything seems to be like the guide, however, when i try to start/restart apache i get this error
root#archimedes:/etc/apache2# /etc/init.d/apache2 restart
Syntax error on line 1 of /home/smau/Workspace/Maynard/tothego_frontend/srv/mod_wsgi/django.wsgi:
Invalid command 'import', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
...fail!
This is /var/log/apache2.log
[Thu Jul 14 11:39:31 2011] [notice] Apache/2.2.17 (Ubuntu) PHP/5.3.5-1ubuntu7.2
with Suhosin-Patch mod_wsgi/3.3 Python/2.7.1+ configured -- resuming normal operations
[Thu Jul 14 11:44:28 2011] [notice] caught SIGTERM, shutting down
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php5/20090626/gd.so'- /usr/lib/php5/20090626/gd.so: cannot open shared object file:
No such file or directory in Unknown on line 0
The log doesn't seem (to me...) anyhow related to my problem. Why do i keep getting the "import" error? Did i give you enought information or do you need something else? I guess my pythonpath is correct:
You're supposed to include the configuration file (django.conf), not the WSGI script (django.wsgi).

Categories

Resources