PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, March 17, 2022

[FIXED] Python with MAMP not working

 March 17, 2022     mamp, python     No comments   

Issue

I'm in the process of switching from PHP over to Python.

The web project I'm on is very very small (probably just two to three script files) so I would prefer to avoid any framework and just work with Python.

I'm running MAMP (not the Pro version) on OS X Yosemite.

My python test file works fine when executed in the terminal. But when I open it in the browser, it just shows the text connect of the file, not the output.

PyTest.py

#!/usr/bin/python
# -*- coding: utf-8 -*-

# enable debugging

import cgitb
cgitb.enable()

print 'Content-Type: text/plain'
print
print 'Hello, World!'

I'm really new to Python. What am I missing? Thanks!


Solution

I realized that I did not completely understand the way Python and Webservers interact and why it wouldn't work with MAMP out of the box.

I'm now using a lightweight web framework (bottle) which has a small development server built in.

The website later will be deployed using NGINX and uWSGI.



Answered By - basbebe
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing