Simple Python server setup

前端 未结 2 1639
你的背包
你的背包 2021-01-06 03:07

I am trying to learn python (coming from PHP), and want to set up the simplest web server so I can start coding.

I found the integrated HTTP server, so I figured it

相关标签:
2条回答
  • 2021-01-06 03:22

    If you are just starting out with python I would recommend you start with scripts that can be run from the console using python interpreter. (eg: python run1.py)

    Once you have mastered the basics, you can move onto web programming. (I am guessing that you want to try web programming since you mention a web server.) In this case, you have multiple options (all of which work with Apache):

    • Django framework : Really good framework, has a built-in webserver and has fantastic documentation (http://www.djangobook.com/en/2.0/index.html). You need to know python basics first
    • WSGI: https://code.google.com/p/modwsgi/ : Apache module for running python code
    0 讨论(0)
  • 2021-01-06 03:33

    Python is for writing programs in general, not only web-sites.

    SimpleHTTPServer is really just a trivial HTTP server, it serves files. It doesn't try to interpret code.

    If you want to do web-development with Python, you should be using a web framework. web.py is a good choice, you can check its tutorial. Another option is Django, which also has a brilliant tutorial.

    Both of them have simple development servers built in, so you'll be able to start experimenting easily.

    0 讨论(0)
提交回复
热议问题