Editing
Running a Django Application on IIS
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Easing the FastCGI configuration === It is somewhat painful to have to specify the `pythonpath` and `settings` parameters both in the FastCGI configuration and in the `web.config` file. To avoid entering them each time, I have created a `manage.py` script in the `scripts` subdirectory of the project root that ''auto configures'' itself. Here is the source of the file: <syntaxhighlight lang="python"> #!/usr/bin/python # -*- coding: utf-8 -*- import os,sys from os.path import abspath, dirname # the base path is my parent directory base_path = dirname(dirname(abspath(__file__))) from django.core.handlers.modpython import handler # Add the parent directory to the path to be able to import settings sys.path.append(base_path) sys.path.append(dirname(base_path)) # Now we can import our settings and setup the environment try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) sys.exit(1) from django.core.management import setup_environ setup_environ(settings) from django.core.management import execute_manager if __name__ == "__main__": execute_manager(settings) </syntaxhighlight> With this script, the `Arguments` setting of the FastCGI application becomes `d:\sites\esplayer\esplayer\scripts\manage.py fcgi` and the `scriptProcessor` attribute in the web.config file becomes <syntaxhighlight lang="xml"> scriptProcessor="D:\python\App\python.exe|d:\sites\esplayer\esplayer\script\manage.py fcgi" </syntaxhighlight>
Summary:
Please note that all contributions to Littledamien Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Littledamien Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information