I'm looking for the fast, easy (all default settings) way of installing Python on my windows machine so that Apache can use it. I currently have a Windows 7 installation with Apache and PHP working. I want to try and make some simple web pages in Python, just to play around with Python for a bit and learn a thing or two. I downloaded and installed Python 3.2 Python 2.7.2 (As advised below).
What do I do next? I would like to make a 'Hello World'. Do I need modpython or can I do without?
I assume I need to tell Apache somehow that Python is available. I probably need to make an 'index.py' file, or something similar? I'm not directly looking for tutorials on the Python language itself, but just for some steps to make the simplest of the simplest script (Hello World) work on my current system. Basically I'm looking for the Python equivalent of the following php script to work in my Apache: Hello World. First of all, especially in the web sector it's better to stay with python 2 (2.7) for now. Lots of frameworks and libraries are not py3-ready yet.
Then you might want to use modwsgi instead of modpython which is deprecated and not available in binary form for recent python versions (and using old python versions such as 2.5 is bad). Finally, unlike PHP it's usually not a good idea to write python webapplications with the idea of 1:1 mappings between files and urls.
Setup Apache Server
To get started with something nice, have a look at the. It has some good examples and a full tutorial. And to make it even better, you don't need Apache for it during development as you can simply run a python-based developmont server. WSGI is a very very low level interface. PHP in comparison provides a lot of higher level functionality which simply will not exist.
Crsi design handbook. If you use WSGI API directly, you will have to reinvent the wheel and for things which may affect the security of your site, likely get it plain wrong. A micro framework like Flask, where things can still be in one file if need be, will do all the mundane stuff for you like handling query strings or form posts, as well as pulling apart headers etc etc.
So, it will save you a lot of work. – Aug 23 '11 at 21:51.
Apache Server SSL Security from DigiCert Whether you wish to secure one or many websites, DigiCert has an effective solution for your Apache Server. All DigiCert SSL Certificates are fully compatible with all versions of Apache HTTP servers. Which Certificate is Right for You?
Because an Apache server can utilize any of the four SSL certificates that we offer (most servers can, there are only really a few exceptions and Apache is not one of them), selecting the certificates that are right for your needs is going to depend more upon the needs of your organization than the needs of your Apache server itself. That is especially helpful in deployments where you will probably need to secure more than one server, or more than one type of server.
Only when I use SSL, apache refuses to start, and I see this error in error.log: Exception ignored in: Traceback (most recent call last): File 'c: python36-32 lib site-packages PIL Image.py', line 585, in del NameError: name 'hasattr' is not defined If I comment out the line Include extra/httpd-ssl.conf, then apache will start fine. (but without ssl of course) I checked the httpd-ssl.conf file, and I think my certificate is correctly set. And this error does not imply anything.
I couldn't find a solution online. Not 100% sure about Windows, but Python 3.6 on MacOS X from PSF now ships with its own SSL libraries. This makes it impossible to use modwsgi with modssl and then use SSL from Python code.
This is because Apache will load its SSL libraries from operating system first. This will be incompatible with the SSL libraries Python ships and things will not work. I can only assume Python 3.6 on Windows must ship with its own SSL libraries as well.
Try and find out if Python 3.6 on Windows does in fact ship with SSL libraries. – Nov 20 '17 at 10:17.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |