Hi,

I am new to Django and am deploying my first application in the web
server (apache2+mod_python).

I putted the project files '/project/webptb/*' under web root
directory '/usr/local/apache2/htdocs'.

When I visit 'http://WebServer/project/webptb/', it works. The output
page and its source are as below:
---output page---
home | login | register
data page
Welcome anonymous user! You need to login before you can view the
data.

---source---
<html>
<head>
  <title>Data</title>
  <link rel="stylesheet" href="/site_media/style.css" type="text/css" /
>
</head>

<body>
  <div id="nav">
    <a href="/">home</a> | <a href="/login/">login</a> | <a href="/
register/">register</a>
  </div>
  <h1>data page</h1>
  <p>Welcome anonymous user! You need to <a href="/login/">login</a>
before you can view the data.</p>

</body>
</html>

The problem is: when I hit the 'login' link in this page, it returns
to http://WebServer/login/, but not to http://WebServer/project/webptb/login/.
For other links are the same. The '/' is the root of the application,
it works in the development by using Django's server. When deploying
the application to a web server, how to automatically add 'project/
webptb' to each href link in the dynamically generated webpages?

---httpd.conf for django---
LoadModule python_module /usr/local/apache2/modules/mod_python.so
PythonPath "['/usr/local/apache2/htdocs/project', '/usr/local/lib/
python2.5/site-packages/django'] + sys.path"
PythonImport /usr/local/apache2/htdocs/project/webptb/file.py django

<Location "/project/webptb/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE webptb.settings
    PythonOption django.root /project/webptb
    PythonDebug On
    PythonInterpreter project
</Location>

---webptb/urls.py---
urlpatterns = patterns('',
    # Example:
    (r'^project/webptb/', include('normal.root.urls')),

    (r'^user/(\w+)/$', user_page),
    (r'^/login/$', 'django.contrib.auth.views.login'),
    (r'^logout/$', logout_page),
    (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
        {r'document_root': site_media}),
    (r'^register/$', register_page),
    (r'^register/success/$', direct_to_template,
        {'template': 'registration/register_success.html'}),

    (r'^gene/$', gene_page),
    (r'^search/$', search_page),
)

Thanks a lot in advance!

Yu Zhou







--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to