Replace PHP with Python with Apache

I'm basically looking for a way to get rid of my PHP dependency, and I would like to switch to Python. I'm having trouble finding a way to make python a replacement in return. I am familiar with Django, but its just not fast and dirty enough for most of the little things I need to do. So I wonder if there is an Apache module or a way to configure mod_wsgi to serve * .py files in the same way that mod_php serves * .php from the server root?

Note. I found various python extensions for php to call code with PHP, but this does not really solve the curly ball.

+4
source share
3 answers

Files that mod_wsgi calls are Python files. In addition, if you install them in daemon mode, updating the python file will restart the daemon. It is pretty smooth.

Another thing you might notice if Django is crowded is Werkzeug , which is pretty much the server interface. You can then add database access using SqlAlchemy and / or Jinja2 templates. Or not.

These parts are pretty much used by people when they want Django to be pieces, and I was told that they are more powerful if there is more maintenance work (some assembly required).

+3
source

Yes, you can do it with mod_wsgi, but if you are new to Python web application development, this is a potentially painful way. In any case, read the documentation at:

http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive

You use AddHander in the same way as with CGI or PHP scripts.

0
source

if you worked with php, you are also familiar with mod_php

there is also mod_python ( http://www.modpython.org/ ), but its inactive community (there are many articles on how to install django with mod_python ( http://docs.djangoproject.com/en/dev/howto/deployment / modpython / ))

but it is better to use wsgi and uwsgi

0
source

Source: https://habr.com/ru/post/1342073/


All Articles