Zoo + Django = Confused?
17 posts
• Page 1 of 1
Zoo + Django = Confused?
So I set up a sample Django project for IIS as described here:
http://www.helicontech.com/articles/run ... nce-tests/
However, after I run the command line steps to create a new Django site inside of the 'mysite' folder, the result is only 3 files - manage.py, settings.py, and urls.py. Trying to then hit these from the browser, I get what appears to be a python settings dump and not the "Welcome to Django" page pictured.
Page returned when hitting localhost:
In Web Platform Installer, if I go to 'Zoo', select 'Templates', and then select 'Django Project' and install, the files appear to complete installation. The WebMatrix dialog is opened and its already created a default "ZooDjangoProject". This is on port 63562. The installed directory includes additional files that I don't have from before, including a web.config file in the same directory as the manage.py (something the tutorial linked to above says not to do?)
1) why doesn't when I follow the tutorial things work?
2) Django 1.5 is out today. How difficult is it to upgrade to the latest version? Can I delete the django folder in my python site-packages and pip install the new version without affecting zoo?
3) the instructions show starting a new project through the interface - but what if I have existing code? how difficult is it to have pull existing django code and "plug it in" to IIS once Zoo is installed? Is it just a matter of a new virtual folder and a web.config file?
http://www.helicontech.com/articles/run ... nce-tests/
However, after I run the command line steps to create a new Django site inside of the 'mysite' folder, the result is only 3 files - manage.py, settings.py, and urls.py. Trying to then hit these from the browser, I get what appears to be a python settings dump and not the "Welcome to Django" page pictured.
Page returned when hitting localhost:
- Code: Select all
APPL_MD_PATH: /LM/W3SVC/1/ROOT
APPL_PATH:
APPL_PHYSICAL_PATH: C:\inetpub\wwwrootAUTH_PASSWORD:
AUTH_TYPE:
AUTH_USER:
CERT_COOKIE:
CERT_FLAGS:
CERT_ISSUER:
CERT_SERIALNUMBER:
CERT_SUBJECT:
CONTENT_LENGTH: 0
CONTENT_TYPE:
DOCUMENT_ROOT: C:\inetpub\wwwrootGATEWAY_INTERFACE: CGI/1.1
HTTPS: off
HTTPS_KEYSIZE:
HTTPS_SECRETKEYSIZE:
HTTPS_SERVER_ISSUER:
HTTPS_SERVER_SUBJECT:
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.3
HTTP_ACCEPT_ENCODING: gzip,deflate,sdch
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
HTTP_CACHE_CONTROL: max-age=0
HTTP_CONNECTION: keep-alive
HTTP_HOST: localhost
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22
INSTANCE_ID: 1
INSTANCE_META_PATH: /LM/W3SVC/1
INSTANCE_NAME: DEFAULT WEB SITE
LOCAL_ADDR: 127.0.0.1
LOGON_USER:
PATH_INFO: /iisdjangosample/
PATH_TRANSLATED: C:\_personal\Vox Pop Design\Placewise\shoptopia_new\sampleIISDjangoSiteQUERY_STRING:
REMOTE_ADDR: 127.0.0.1
REMOTE_HOST: 127.0.0.1
REMOTE_PORT: 59933
REMOTE_USER:
REQUEST_METHOD: GET
REQUEST_URI: /iisdjangosample/
SCRIPT_FILENAME: C:\_personal\Vox Pop Design\Placewise\shoptopia_new\sampleIISDjangoSiteSCRIPT_NAME:
SERVER_NAME: localhost
SERVER_PORT: 80
SERVER_PORT_SECURE: 0
SERVER_PROTOCOL: HTTP/1.1
SERVER_SOFTWARE: Microsoft-IIS/7.5
URL: /iisdjangosample/
wsgi.errors: <__main__.TeeOutputStream object at 0x00F13C70>
wsgi.input: <__main__.InputStream object at 0x00F13870>
wsgi.multiprocess: False
wsgi.multithread: False
wsgi.run_once: False
wsgi.url_scheme: http
wsgi.version: (1, 0)
sys.version: 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit (Intel)]
In Web Platform Installer, if I go to 'Zoo', select 'Templates', and then select 'Django Project' and install, the files appear to complete installation. The WebMatrix dialog is opened and its already created a default "ZooDjangoProject". This is on port 63562. The installed directory includes additional files that I don't have from before, including a web.config file in the same directory as the manage.py (something the tutorial linked to above says not to do?)
1) why doesn't when I follow the tutorial things work?
2) Django 1.5 is out today. How difficult is it to upgrade to the latest version? Can I delete the django folder in my python site-packages and pip install the new version without affecting zoo?
3) the instructions show starting a new project through the interface - but what if I have existing code? how difficult is it to have pull existing django code and "plug it in" to IIS once Zoo is installed? Is it just a matter of a new virtual folder and a web.config file?
Re: Zoo + Django = Confused?
Hello.
1) The tutorial has steps to create additional files (web.config, requirements.txt, deploy.py) that are contained in ZooDjangoProject. Do you have done these steps?
Generally the best way to run django app on IIS is using ZooDjangoProject.
2) Update to Django 1.5 is easy.
Remove python_modules\site-packages\django folder (under web site, if exists).
Replace in requirements.txt line
to
and run
Django 1.5 will be installed in local (under web site) site-packages folder and do not affect global python packages and Zoo.
3) To run existing django project with Zoo follow these steps:
- deploy ZooDjangoProject in folder where you want to run your django project (web site root or iis application);
- copy your project files into this folder;
- check the PYTHON_PATH env in web.config contains all required paths for your project;
- check the DJANGO_SETTINGS_MODULE env in web.config point to your settings.py project file;
- put in folders with static or media files this web.config to processing directly by IIS:
1) The tutorial has steps to create additional files (web.config, requirements.txt, deploy.py) that are contained in ZooDjangoProject. Do you have done these steps?
Generally the best way to run django app on IIS is using ZooDjangoProject.
2) Update to Django 1.5 is easy.
Remove python_modules\site-packages\django folder (under web site, if exists).
Replace in requirements.txt line
- Code: Select all
django==1.3
to
- Code: Select all
django==1.5
and run
- Code: Select all
deploy.py
Django 1.5 will be installed in local (under web site) site-packages folder and do not affect global python packages and Zoo.
3) To run existing django project with Zoo follow these steps:
- deploy ZooDjangoProject in folder where you want to run your django project (web site root or iis application);
- copy your project files into this folder;
- check the PYTHON_PATH env in web.config contains all required paths for your project;
- check the DJANGO_SETTINGS_MODULE env in web.config point to your settings.py project file;
- put in folders with static or media files this web.config to processing directly by IIS:
- Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<!--
This removes Helicon Zoo handler and makes IIS processing static files.
-->
<remove name="django.project#x64" />
<remove name="django.project#x86" />
</handlers>
</system.webServer>
</configuration>
Re: Zoo + Django = Confused?
I setup the web.config file as described in the tutorial.
I did not setup the requirements.txt or deploy.py; those steps came after the screenshot showing a successful new django project. I did not get to the installation of modules before I started experiencing deviations from what was shown.
I did not setup the requirements.txt or deploy.py; those steps came after the screenshot showing a successful new django project. I did not get to the installation of modules before I started experiencing deviations from what was shown.
Re: Zoo + Django = Confused?
Thinking I might have had a dependency conflict with the previously installed Activestate Python for windows, I completely uninstalled that package from my machine. I then re-installed helicontech's python package from the Web Platform Installer, as described in the linked tutorial. I then followed the instructions listed. Once again, when I get to the portion of the tutorial where I test the sample django app in the web browser, I'm getting a python variable dump, NOT the sample webpage.
In IIS I have two sites listed under the 'Sites' folder: the 'Default Web Site' which I have stopped because IIS didn't want to share port 80 otherwise, and my newly created website to point to my sample django project. The physical path points to the webroot containing the web.config and mysite folder created via the command line.
Thinking maybe the tutorial expects the latter mentioned deploy.py and requirements.txt to be there, I created them in the web root as show in the tutorial. Now my web root looks like:
- web.config
- requirements.txt
- deploy.py
- a folder of mysite, which was created from the command line
When I restart the site in IIS and then try to hit it in a browser I get the "Application Deployment in Process". It never completes. Nothing is ever written to the deploy log.
Really stuck here.
In IIS I have two sites listed under the 'Sites' folder: the 'Default Web Site' which I have stopped because IIS didn't want to share port 80 otherwise, and my newly created website to point to my sample django project. The physical path points to the webroot containing the web.config and mysite folder created via the command line.
Thinking maybe the tutorial expects the latter mentioned deploy.py and requirements.txt to be there, I created them in the web root as show in the tutorial. Now my web root looks like:
- web.config
- requirements.txt
- deploy.py
- a folder of mysite, which was created from the command line
When I restart the site in IIS and then try to hit it in a browser I get the "Application Deployment in Process". It never completes. Nothing is ever written to the deploy log.
Really stuck here.
Re: Zoo + Django = Confused?
trying to follow the web matrix template, I can't just open up Microsoft web matrix and see the django template in the list of templates. I have to go to the Microsoft web platform installer, click 'Zoo', select 'Templates', hit 'Add' next to the Django project and select 'install' every single time. (Despite doing this multiple times, Django project is always a prerequisite that shows up as needing to be installed.)
After install is complete and I am told the Django project was successfully installed I click 'Finish'. Web Matrix is automatically launched and ZooDjangoProject appears, and a web browser is launched. Even if I try and create a new project from this just-launched web matrix, a new django site does not exist in the list of available templates.
After install is complete and I am told the Django project was successfully installed I click 'Finish'. Web Matrix is automatically launched and ZooDjangoProject appears, and a web browser is launched. Even if I try and create a new project from this just-launched web matrix, a new django site does not exist in the list of available templates.
Re: Zoo + Django = Confused?
Ok - some progress.
The Django template not successfully installing as part of Web Matrix still remains.
However, I did get the manual file setup to work as expected. My problem was the line:
"Note “DJANGO_SETTINGS_MODULE” variable with the name of the application just created"
I interpreted that to mean "Change the “DJANGO_SETTINGS_MODULE” variable to the name of the application just created". Obviously, that was wrong. I corrected it. I had to restart the IIS service (not just restart the site) as it continued to show the locked "Application Deployment in Progress" screen. Once I restarted the IIS service from the command line (net stop WAS" and restart it (net start WS3VC) I got the correct "It worked! Congratulations on your first Django-powered page." output.
Now to try and get things updated to Django 1.5.
The Django template not successfully installing as part of Web Matrix still remains.
However, I did get the manual file setup to work as expected. My problem was the line:
"Note “DJANGO_SETTINGS_MODULE” variable with the name of the application just created"
I interpreted that to mean "Change the “DJANGO_SETTINGS_MODULE” variable to the name of the application just created". Obviously, that was wrong. I corrected it. I had to restart the IIS service (not just restart the site) as it continued to show the locked "Application Deployment in Progress" screen. Once I restarted the IIS service from the command line (net stop WAS" and restart it (net start WS3VC) I got the correct "It worked! Congratulations on your first Django-powered page." output.
Now to try and get things updated to Django 1.5.
Re: Zoo + Django = Confused?
Even if I try and create a new project from this just-launched web matrix, a new django site does not exist in the list of available templates.
There is no correct way to embed Zoo templates in Web Matrix templates. So you can install Zoo templates from Web Platform installer (first selecting IIS Express as Web Server in WPI Options).
Re: Zoo + Django = Confused?
However, I did get the manual file setup to work as expected. My problem was the line:
"Note “DJANGO_SETTINGS_MODULE” variable with the name of the application just created"
I provide examples to understand how to set DJANGO_SETTINGS_MODULE.
Example 1.
Web site root point to c:\inetpub\wwwroot (it is environment variable APPL_PHYSICAL_PATH)
Django project deployed to web site root c:\inetpub\wwwroot
PYTHON_PATH must be set to %APPL_PHYSICAL_PATH%
DJANGO_SETTINGS_MODULE must be set to 'settings'
Example 2.
Web site root point to c:\inetpub\wwwroot (it is environment variable APPL_PHYSICAL_PATH)
Django project deployed into folder under site c:\inetpub\wwwroot\app1
PYTHON_PATH must be set to %APPL_PHYSICAL_PATH%
DJANGO_SETTINGS_MODULE must be set to 'app1.settings'
- or -
PYTHON_PATH must be set to "%APPL_PHYSICAL_PATH%\app1"
then DJANGO_SETTINGS_MODULE must be set to 'settings'
Re: Zoo + Django = Confused?
K - things still aren't working with the deploy.py and requirements.txt file. When I restart IIS the deployment screen just loads forever - no messages are output to the screen under "deploy log".
Again, I'm following the instructions here:
http://www.helicontech.com/articles/running-django-on-windows-with-performance-tests/
I've created a new django site in a folder outside of the IIS webroot, and modified the default website so that when I hit '127.0.0.1' in a browser I'm seeing the "It worked! Congratulations on your first Django-powered page".
I've added the deploy.py and requirements.txt files with the suggested file contents to the top level directory, alongside the web.config file but above the mysite folder. However, nothing ever happens. If the python_modules file is supposed to be created after an IIS restart, it isn't.
Is there a log file for errors that I could check?
Again, I'm following the instructions here:
http://www.helicontech.com/articles/running-django-on-windows-with-performance-tests/
I've created a new django site in a folder outside of the IIS webroot, and modified the default website so that when I hit '127.0.0.1' in a browser I'm seeing the "It worked! Congratulations on your first Django-powered page".
I've added the deploy.py and requirements.txt files with the suggested file contents to the top level directory, alongside the web.config file but above the mysite folder. However, nothing ever happens. If the python_modules file is supposed to be created after an IIS restart, it isn't.
Is there a log file for errors that I could check?
Re: Zoo + Django = Confused?
Hmmm... Ok, I had my sample site setup as a separate website in IIS when things weren't working. Picking up on a line in the first response to this thread, I changed the site to an application beneath the 'Default Web Site'. Hitting the site in the web browser, I briefly got the sample deployment screen but now it completed. It created a 'static' folder at the same level as the web.config, requirements.txt and mysite folders. Items requiring a modules create a python_modules folder at the same level.
What's interesting is that the deploy.py script is replaced with a deploy_done.py. I needed to rename the script as I layered on additional assets once I figured out the naming.
Little by little, getting there...
What's interesting is that the deploy.py script is replaced with a deploy_done.py. I needed to rename the script as I layered on additional assets once I figured out the naming.
Little by little, getting there...
Re: Zoo + Django = Confused?
What's interesting is that the deploy.py script is replaced with a deploy_done.py. I needed to rename the script as I layered on additional assets once I figured out the naming.
Yes, it is feature.
deploy.py must be executed once at prodcution, so after execution it was renamed.
On dev environment you can execute it manually.
Note again that the better way to create django site on IIS is deploying ZooDjangoProject from Web Platform Installer.
Re: Zoo + Django = Confused?
Using the Web Platform Installer is not an option as it adds another dependency to the tool chain.
Currently I'm getting timeouts when attempting to pip Django 1.5. There are also certain requirements that I can't download with pip. Can I just unpack the eggs directly into the python_modules/Lib/site-packages folder? What other dependencies/files need to be updated to reference those libraries?
Currently I'm getting timeouts when attempting to pip Django 1.5. There are also certain requirements that I can't download with pip. Can I just unpack the eggs directly into the python_modules/Lib/site-packages folder? What other dependencies/files need to be updated to reference those libraries?
Re: Zoo + Django = Confused?
The problem with the log file not appearing is that the tutorial doesn't reference the need to create a log directory in the same directory as the web.config, requirements.txt, etc. After I created a log directory, the deployment process then started to write the deploy.log file. Without the folder being created ahead of time writing the deploy.log file would fail and no message would be outputted to the deployment screen.
Re: Zoo + Django = Confused?
Wunderbar!
So I fixed my timeout problem on the Django issue. I modified the pip line in the deploy.py script from:
to:
Dunno if I really needed 120, but that seemed to do the trick.
So I fixed my timeout problem on the Django issue. I modified the pip line in the deploy.py script from:
- Code: Select all
status = os.system('{0} install --install-option="--prefix={1}" --build="{2}" --requirement=requirements.txt'.format(
to:
- Code: Select all
status = os.system('{0} --default-timeout=120 install --install-option="--prefix={1}" --build="{2}" --requirement=requirements.txt'.format(
Dunno if I really needed 120, but that seemed to do the trick.
Re: Zoo + Django = Confused?
Using the Web Platform Installer is not an option as it adds another dependency to the tool chain.
One of the objectives of Helicon Zoo project is provide easy way to prepare ready-to-use Python (Ruby, CFML, ...) environment.
So installing Django app template it add all required dependecies.
- Code: Select all
Can I just unpack the eggs directly into the python_modules/Lib/site-packages folder?
Yes, it is. Or unpack into any place and then add it to PYTHONPATH environment variable.
--default-timeout=120
Why so big timeout? Do you have slow internet connection? Or unreacheable pip repository?
Re: Zoo + Django = Confused?
I am on a fast connection. However, for whatever reason, downloading Django 1.5 for my installation was resulting in timeout errors. I don't think the point should be to question my connection, but to help document all the missing details left out of the tutorial.
I did get the sample code working as described in the tutorial. But as soon as I put my current project in and reconfigured the web.config and requirements folder I'm now getting "Internal Server Errors". At this point there seem to be as many tweaks required using the Helicon approach as there are with the original "DjangoOnWindowsWithIISAndSQLServer" article. I understand there may be some pre-packaged templates but as soon as one deviates from those exact specifics they are on their own without support.
I did get the sample code working as described in the tutorial. But as soon as I put my current project in and reconfigured the web.config and requirements folder I'm now getting "Internal Server Errors". At this point there seem to be as many tweaks required using the Helicon approach as there are with the original "DjangoOnWindowsWithIISAndSQLServer" article. I understand there may be some pre-packaged templates but as soon as one deviates from those exact specifics they are on their own without support.
Re: Zoo + Django = Confused?
with the original "DjangoOnWindowsWithIISAndSQLServer" article
Sql Server for django app is not a good idea. Mysql or Postgre runs just fine on Windows with native django support.
In order to test your deployment in a such way (from command line in your projet folder):
- Code: Select all
set PYTHONPATH={you python from from web.config}
manage.py runserver
if this will work, then django project under Zoo will be working are more likely.
17 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests