在 Windows 上使用 XAMPP 托管 Django

2022-01-14 00:00:00 python django xampp

问题描述

我可以在 Windows 上使用 XAMPP 运行 Django(Python 框架)基础站点吗?请指导我.

Can I run a Django (Python framework) base site with XAMPP on Windows? Please guide me.


解决方案

XAMPP forwindows 包含:Apache、MySQL、PHP + PEAR、Perl、mod_phpmod_perlmod_ssl、OpenSSL、phpMyAdmin、Webalizer、Mercury Mail Transport System适用于 Win32 和 NetWare Systems v3.32、Ming、JpGraph、FileZilla FTP Server、mcrypt、eAccelerator、SQLite 和 WEB-DAV + mod_auth_mysql.

XAMPP for windows contains: Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System for Win32 and NetWare Systems v3.32, Ming, JpGraph, FileZilla FTP Server, mcrypt, eAccelerator, SQLite, and WEB-DAV + mod_auth_mysql.

运行django缺少两个要求:

There are two requirements to run django missing:

  • Python
  • mod_wsgi

所以,不,你不能单独使用 XAMPP 运行 django.您需要安装其他软件.

So, NO, you can't run django with XAMPP alone. You need to install additional software.

但是运行 django 非常容易.如果你只是想开发一个应用程序,你只需要python和django.Django 本身包含一个可用于开发的内部 Web 服务器.

However running django is very easy. If you just want to develop an application, you only need python and django. Django itself includes an internal web server that can be used for development.

如果你想在 Windows 上使用 django 作为生产服务器,你甚至不需要 apache web 服务器.你可以只安装:

If you want to use django on windows for a production server, you don't even need the apache web server. You could install just:

  • Python
  • cherrypy

这足以让一个好的 django 生产服务器启动并运行,因为cherrypy 的 web 服务器是用 python 编写的,并且可以很好地服务于 django(或任何其他 wsgi-兼容)应用程序.如果您没有将 apache 用于其他任何事情,我认为此设置实际上更好更容易.您可以使用其他网络服务器来代替cherrypy.但是如果你真的要使用apache,你还需要mod_wsgi.

That's enough to have a good django production server up and running, since cherrypy's web server is written in python and is pretty good to serve django (or any other wsgi-compatible) applications. If you're not using apache for anything else I think this setup is actually better and easier. There are other webservers you could use instead of cherrypy. But if you really want to use apache, you also need mod_wsgi.

相关文章