[Django] deploy Django on Apache

Source: Internet
Author: User
Tags django website install django

1. install Apache 2.0.59
http://mirror.vmmatrix.net/apache/httpd/binaries/win32/apache_2.0.59-win32-x86-no_ssl.msi
28.0 install mod_python-3.2.10.win32-py2.4-apache2.2.exe
http://www.apache.org/dist/httpd/modpython/win/3.2.10/mod_python-3.2.10.win32-py2.4-apache2.0.exe
after installation, prompt you to choose the installation directory of apache2.0, install the mod_python.so file to the modules directory of apache
3. Download and install Django through SVN
SVN Co http://code.djangoproject.com/svn/d Jango/trunk/
4. Create a Django project.
for example, create the Django project newtest in the E:/Django directory and enter:
django-admin.py startproject newtest
(note that C: \ python24 \ scripts is set to the path of the system)
5. Use the built-in WebServer of Django to test this project.
in the E:/Django/newstest directory:
Manage. PY runserver
enter http: // 127.0.0.1: 8000 in the address bar.
see:
it worked!
congratulations on your first Django-powered page.
the Django website is successful.
let's see how to deploy it in Apache.

6. Modify httpd. conf.
Add
Loadmodule python_module modules/mod_python.so
Add
<Location "/newtest/">
Sethandler Python-Program
Pythonpath"['E:/Django ']+ SYS. path"
Pythonhandler Django. Core. Handlers. modpython
Setenv django_settings_moduleNewtest. Settings
Pythondebug on
</Location>

<Location "/Media/">
Sethandler none
</Location>

<Locationmatch "\. (JPG | GIF | PNG) $">
Sethandler none
</Locationmatch>
7. Restart Apache and check http: // 127.0.0.1: 8080/newtest.
You can see the same effect of Django's built-in webserver.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.