Setting custom django.wsgi entries
5 posts
• Page 1 of 1
Setting custom django.wsgi entries
Hi,
Our app requires the following entries setup in django.wsgi:
PROJECT_ROOT = os.path.dirname(__file__)
INNER_ROOT = os.path.join(PROJECT_ROOT, 'app')
sys.path.insert(0, PROJECT_ROOT)
sys.path.insert(1, INNER_ROOT)
Any idea where to insert them in Helicon Zoo?
Thanks!
Our app requires the following entries setup in django.wsgi:
PROJECT_ROOT = os.path.dirname(__file__)
INNER_ROOT = os.path.join(PROJECT_ROOT, 'app')
sys.path.insert(0, PROJECT_ROOT)
sys.path.insert(1, INNER_ROOT)
Any idea where to insert them in Helicon Zoo?
Thanks!
Re: Setting custom django.wsgi entries
Hello!
There is a two ways to update PYTHONPATH:
1. Update PYTHONPATH environment variable in heliconZoo/application/environmentVariables section of web.config. Use %APPL_PHYSICAL_PATH% to get current directory:
2. Update your custom wsgi file and specify his path in web.config:
Note in this case you should move setup of DJANGO_SETTINGS_MODULE env variable from web.config to your wsgi file.
Also you can install Python App Template http://www.helicontech.com/zoo/gallery/ ... oject.html
and look at our instructions to run different python apps.
Thank you!
There is a two ways to update PYTHONPATH:
1. Update PYTHONPATH environment variable in heliconZoo/application/environmentVariables section of web.config. Use %APPL_PHYSICAL_PATH% to get current directory:
- Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<heliconZoo>
<application name="python.project">
<environmentVariables>
<add name="PYTHONPATH" value="%APPL_PHYSICAL_PATH%\venv\lib\site-packages;%APPL_PHYSICAL_PATH%\venv\lib;%APPL_PHYSICAL_PATH%;%APPL_PHYSICAL_PATH%\project" />
...
</environmentVariables>
</application>
</heliconZoo>
...
</system.webServer>
</configuration>
2. Update your custom wsgi file and specify his path in web.config:
- Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<heliconZoo>
<application name="python.project">
<environmentVariables>
<add name="PYTHONPATH" value="%APPL_PHYSICAL_PATH%\venv\lib\site-packages;%APPL_PHYSICAL_PATH%\venv\lib;%APPL_PHYSICAL_PATH%;%APPL_PHYSICAL_PATH%\project" />
<add name="WSGI_APP" value="your.wsgi" /> ...
</environmentVariables>
</application>
</heliconZoo>
...
</system.webServer>
</configuration>
Note in this case you should move setup of DJANGO_SETTINGS_MODULE env variable from web.config to your wsgi file.
Also you can install Python App Template http://www.helicontech.com/zoo/gallery/ ... oject.html
and look at our instructions to run different python apps.
Thank you!
Re: Setting custom django.wsgi entries
Hi,
Tried the 2nd approach:
<add name="WSGI_APP" value="app\django.wsgi" />
Getting error now:
STDERR
Traceback (most recent call last):
File "C:\Zoo\Workers\python\zoofcgi.py", line 1072, in <module>
run_wsgi_app(options.wsgi_app)
File "C:\Zoo\Workers\python\zoofcgi.py", line 1007, in run_wsgi_app
wsgi_app = import_function(wsgi_app_path)
File "C:\Zoo\Workers\python\zoofcgi.py", line 1021, in import_function
m = getattr(m, comp)
AttributeError: 'module' object has no attribute 'wsgi'
Any idea?
Tried the 2nd approach:
<add name="WSGI_APP" value="app\django.wsgi" />
Getting error now:
STDERR
Traceback (most recent call last):
File "C:\Zoo\Workers\python\zoofcgi.py", line 1072, in <module>
run_wsgi_app(options.wsgi_app)
File "C:\Zoo\Workers\python\zoofcgi.py", line 1007, in run_wsgi_app
wsgi_app = import_function(wsgi_app_path)
File "C:\Zoo\Workers\python\zoofcgi.py", line 1021, in import_function
m = getattr(m, comp)
AttributeError: 'module' object has no attribute 'wsgi'
Any idea?
Re: Setting custom django.wsgi entries
Hello!
WSGI_APP is python-style modules path, not filesystem path.
So if your python module named 'app' (contains __init__.py file, located in PYTHONPATH) and it has django.py with wsgi function, then your WSGI_APP is
app.django.wsgi
Please see more at http://docs.python.org/2/tutorial/modules.html
Also you can install Python App Template http://www.helicontech.com/zoo/gallery/ZooPythonProject.html
and look at our example with running WSGI application.
If you show the structure of the project and your file with wsgi application, i can give a more specific answer.
Thank you.
WSGI_APP is python-style modules path, not filesystem path.
So if your python module named 'app' (contains __init__.py file, located in PYTHONPATH) and it has django.py with wsgi function, then your WSGI_APP is
app.django.wsgi
Please see more at http://docs.python.org/2/tutorial/modules.html
Also you can install Python App Template http://www.helicontech.com/zoo/gallery/ZooPythonProject.html
and look at our example with running WSGI application.
If you show the structure of the project and your file with wsgi application, i can give a more specific answer.
Thank you.
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 6 guests