Note that there are some explanatory texts on larger screens.

plurals
  1. POError while deploying Django on Apache
    primarykey
    data
    text
    <p>I have a small Django website which I am trying to run on an Apache 2.2 HTTP-Server. The application is running fine using "python manage.py runserver".</p> <p>Django Version: 1.0.2 final <br /> Python: 2.5<br /> OS: Windows 2000<br /></p> <p>I wen't through the steps described in the <a href="http://docs.djangoproject.com/en/dev//howto/deployment/modpython/" rel="nofollow noreferrer">documentation</a> and after some fiddling, came out with the following in my httpd.conf.</p> <pre><code>&lt;Location "/therap/"&gt; SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE settings PythonOption django.root /therap PythonDebug On PythonPath "['D:/therap/therap'] + sys.path" &lt;/Location&gt; MaxRequestsPerChild 1 </code></pre> <p>D:\therap\therap beeing the place where my manage.py is.</p> <p>When I try to open in my browser, I see an error in the style used by Django (as opposed to black courier on white background.)</p> <pre><code>ImportError at / No module named therap.urls Request Method: GET Request URL: http://****:8080/ Exception Type: ImportError Exception Value: No module named therap.urls Exception Location: C:\python25\lib\site-packages\django\core\urlresolvers.py in _get_urlconf_module, line 200 Python Executable: C:\Programme\Apache Software Foundation\Apache2.2\bin\httpd.exe Python Version: 2.5.1 Python Path: ['D:/therap/therap', 'C:\\WINNT\\system32\\python25.zip', 'C:\\Python25\\Lib', 'C:\\Python25\\DLLs', 'C:\\Python25\\Lib\\lib-tk', 'C:\\Programme\\Apache Software Foundation\\Apache2.2', 'C:\\Programme\\Apache Software Foundation\\Apache2.2\\bin', 'C:\\Python25', 'C:\\Python25\\lib\\site-packages', 'C:\\Python25\\lib\\site-packages\\pyserial-2.2', 'C:\\Python25\\lib\\site-packages\\win32', 'C:\\Python25\\lib\\site-packages\\win32\\lib', 'C:\\Python25\\lib\\site-packages\\Pythonwin', 'C:\\Python25\\lib\\site-packages\\wx-2.8-msw-unicode'] Server time: Mo, 23 Mär 2009 16:27:03 +0100 </code></pre> <p>There is a urls.py in D:\therap\therap. However there is none in D:\therap\therap\main where most of my code is.</p> <p>I then tried using the parent folder</p> <pre><code>&lt;Location "/therap/"&gt; SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE therap.settings PythonOption django.root /therap PythonDebug On PythonPath "['D:/therap'] + sys.path" &lt;/Location&gt; MaxRequestsPerChild 1 </code></pre> <p>Which gave me a different error:</p> <pre><code>MOD_PYTHON ERROR ProcessId: 2424 Interpreter: '***' ServerName: '****' DocumentRoot: 'C:/Programme/Apache Software Foundation/Apache2.2/htdocs' URI: '/therap/' Location: '/therap/' Directory: None Filename: 'C:/Programme/Apache Software Foundation/Apache2.2/htdocs/therap' PathInfo: '/' Phase: 'PythonHandler' Handler: 'django.core.handlers.modpython' Traceback (most recent call last): File "C:\Python25\Lib\site-packages\mod_python\importer.py", line 1537, in HandlerDispatch default=default_handler, arg=req, silent=hlist.silent) File "C:\Python25\Lib\site-packages\mod_python\importer.py", line 1229, in _process_target result = _execute_target(config, req, object, arg) File "C:\Python25\Lib\site-packages\mod_python\importer.py", line 1128, in _execute_target result = object(arg) File "C:\Python25\lib\site-packages\django\core\handlers\modpython.py", line 228, in handler return ModPythonHandler()(req) File "C:\Python25\lib\site-packages\django\core\handlers\modpython.py", line 201, in __call__ response = self.get_response(request) File "C:\python25\Lib\site-packages\django\core\handlers\base.py", line 67, in get_response response = middleware_method(request) File "C:\python25\Lib\site-packages\django\middleware\locale.py", line 17, in process_request translation.activate(language) File "C:\python25\Lib\site-packages\django\utils\translation\__init__.py", line 73, in activate return real_activate(language) File "C:\python25\Lib\site-packages\django\utils\translation\trans_real.py", line 209, in activate _active[currentThread()] = translation(language) File "C:\python25\Lib\site-packages\django\utils\translation\trans_real.py", line 198, in translation default_translation = _fetch(settings.LANGUAGE_CODE) File "C:\python25\Lib\site-packages\django\utils\translation\trans_real.py", line 183, in _fetch app = __import__(appname, {}, {}, []) ImportError: No module named main </code></pre> <p>I do use the internationalization module, but I do not see why it causes a problem at this point.</p> <p>"main" is the name of the only Django app (containing views, models, forms and such). The full path is D:\therap\therap\main.</p> <p>I put <code>__init__.py</code>-files everywhere from the main folder to d:\therap.</p> <p>Now I don't know what else I could do. Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload