Changes between Version 15 and Version 16 of DjangoOnWindowsWithIISAndSQLServer


Ignore:
Timestamp:
Sep 23, 2006, 5:26:59 AM (18 years ago)
Author:
rockallite.wulf@…
Comment:

Add a Hello World example

Legend:

Unmodified
Added
Removed
Modified
  • DjangoOnWindowsWithIISAndSQLServer

    v15 v16  
    6767=== Installing Django ===
    6868Drop to a command prompt (start -> run -> "cmd" -> OK), change to your Python folder and install Django. Example:
     69
    6970{{{
    7071c:\> cd python24\django
     
    7576
    7677{{{
    77 E:\> md test
    78 e:\> cd test
    79 E:\test>d:\Python24\django\django\bin\django-admin.py startproject proj
     78c:\> md test
     79c:\> cd test
     80c:\test> d:\Python24\django\django\bin\django-admin.py startproject proj
    8081
    81 E:\test>cd proj
     82c:\test> cd proj
    8283
    83 E:\test\proj>python manage.py runserver
     84c:\test\proj> python manage.py runserver
    8485Validating models...
    85860 errors found.
     
    100101# Add these two lines, and python will import DJANGO_SETTINGS_MODULE with no problem
    101102import sys
    102 sys.path.append(r'E:\test')
     103sys.path.append(r'c:\test')
    103104
    104105# Indicate the settings module of your project
     
    124125
    125126=== 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.
     127Supposed 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.
    129128
    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:
    131130
    132 ... I'll leave you to sort out your Import Path and DJANGO_SETTINGS_MODULE and stuff ...
     131{{{
     132from django.http import HttpResponse
    133133
    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.
     134def 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{{{
     141from django.conf.urls.defaults import *
     142
     143urlpatterns = 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
     153You 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.
    135154
    136155== Known Issues ==
Back to Top