![]() What’s the Python3 equivalent of python -m CGIHTTPServer?Īnother common trick is to use the CGI (Common Gateway Interface) server in Python for CGI scripts in python or perl. Just as before, hit return and the active directory will be turned into a web server. This will depend on how you updated to Python 3 on the Mac, but a common example would be using the ‘python3’ command instead: * Important Note: if you have python and python3 installed concurrently, you may need to change the syntax slightly to reference python3 and python2 or another python version. You can test this immediately by opening the following URL in any web browser on the computer:Īll web server activity, like accessing individual files, folders, directories, etc, will be shown in the active Python terminal window live as it happens, sort of like tailing web logs on an Apache or Nginx server. The rver in Python 3 will run in the terminal, if there is no web file in the directory than the directory index itself will be shown. Hit return and Python 3 will instantly start a simple HTTP server from the directory in which the command was executed. OR (depending on how Python 3.x is installed and named): We’re assuming you have already installed or updated to Python 3.0+ on the Mac, this variation of the command requires Python 3.0 or newer.įrom the command line, enter the following syntax exactly*: How to Start a Web HTTP Server in Python 3.0+ We’ll show you how to start a simple web server with Python 3 by using the new Python 3.0+ equivalent of the python -m SimpleHTTPServer command. create a django project and configure the settings.Not to worry, the simple web server Python trick still works in Python 3 for Mac (and for Linux and Windows too of course, but we’re obviously covering MacOS), it’s that the command syntax is just slightly different. If everything works fine, then the last command above should show the full path of the mysql module compiled during the installation process the latter should compile with few minor warnings if and only if we have correctly executed step1 (just double check that paths in the export statements are correct) pip install django now we're ready to install django and mysql-python. Create a new virtual environment and activate it: python virtualenv.py django-mysql ![]() assuming we have already a python virtualenv script in place. Also add a variable for the dynamic library linkage, this will be used on execution of your python scripts to find the correct library: export PATH=/usr/local/mysql/bin/:$PATHĮxport DYLD_LIBRARY_PATH=/usr/local/mysql/lib/ Then from the command line, add the fresh installation to the local path, this will be used to pick the sources needed for the python module compilation. download and install the latest mysql community server from the DMG file, here. It still needs to have a "dedicated" copy of MySQL installed just to compile, but it won't be used to actually run the server. I had to go through a painful series of steps to eventually have the whole thing working, and taking here some notes so I can have them handy when I'll need to do it again, hopefully it will help someone else. The thing is I didn't want to use a dedicated MySQL server just for the Django deployment, as it seems really silly when I already have my quiet MAMP running in parallel with all the other CodeIgniter-PHP based projects. I started playing with a Django-Python version of my current project and I needed a testing environment on my local Mac-based machine. Setting up Django with MAMP on Mac OS X Lion (in ? steps) 11:31:50 +0000
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |