Changes between Version 15 and Version 16 of DjangoOnWindowsWithIISAndSQLServer
- Timestamp:
- Sep 23, 2006, 5:26:59 AM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DjangoOnWindowsWithIISAndSQLServer
v15 v16 67 67 === Installing Django === 68 68 Drop to a command prompt (start -> run -> "cmd" -> OK), change to your Python folder and install Django. Example: 69 69 70 {{{ 70 71 c:\> cd python24\django … … 75 76 76 77 {{{ 77 E:\> md test78 e:\> cd test79 E:\test>d:\Python24\django\django\bin\django-admin.py startproject proj78 c:\> md test 79 c:\> cd test 80 c:\test> d:\Python24\django\django\bin\django-admin.py startproject proj 80 81 81 E:\test>cd proj82 c:\test> cd proj 82 83 83 E:\test\proj>python manage.py runserver84 c:\test\proj> python manage.py runserver 84 85 Validating models... 85 86 0 errors found. … … 100 101 # Add these two lines, and python will import DJANGO_SETTINGS_MODULE with no problem 101 102 import sys 102 sys.path.append(r' E:\test')103 sys.path.append(r'c:\test') 103 104 104 105 # Indicate the settings module of your project … … 124 125 125 126 === Serving Django with IIS === 126 You have created a new virtual folder in IIS, and added the PyISAPIe extension and tweaked it to drive django sites. 127 There is also an addition to Django so it can be driven by PyISAPIe. 128 And, you can now use django-admin.py to create a site inside the virtual folder. 127 Supposed that you have successfully settled everything above, and pointed the virtual directory /myfolder to c:\test folder, we'll now make a Hello World page in Django. 129 128 130 You have everything you need to have Django running from IIS. Now visit http://site/myfolder/ to take a look. You don't need to manually start a Django server. 129 * Create a file called ''helloworld.py'' in c:\test\proj folder with the following content: 131 130 132 ... I'll leave you to sort out your Import Path and DJANGO_SETTINGS_MODULE and stuff ... 131 {{{ 132 from django.http import HttpResponse 133 133 134 Now, while I don't have an app running, I do have Django errors rather than IIS errors. I need to get my model access sorted for my test app. 134 def index(request): 135 return HttpResponse("Hello world!") 136 }}} 137 138 * Modify ''urls.py'' in c:\test\proj folder, so you get the url "dispatched": 139 140 {{{ 141 from django.conf.urls.defaults import * 142 143 urlpatterns = patterns('', 144 # Example: 145 # (r'^newtest/', include('proj.apps.foo.urls.foo')), 146 (r'^.*$', 'proj.helloworld.index'), 147 148 # Uncomment this for admin: 149 # (r'^admin/', include('django.contrib.admin.urls')), 150 ) 151 }}} 152 153 You have everything you need to have Django running from IIS. Now visit http://site/myfolder/ to take a look. Notice that you don't need to manually start a Django server. 135 154 136 155 == Known Issues ==