| OS X - Operating System General OS operation information and support |
| Post Reply | New Thread | Subscribe |
|
|
Thread Tools |
![]() Member Since: Dec 10, 2010
Posts: 1
![]() |
Hi, ive been messing around with terminal and I saw this code that can set up a very simple server on your 8080 port
python -m SimpleHTTPServer 8080 And it works great and ive had fun messing around with it, but when i put an html file named index.htm or named anything else, the html code isn't translated into the page, it justs displays the code i've navigated to the file /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SimpleHTTPServer.py and found that when I edit it, i can edit the html file that is the root directory when you start that server, the only thing is that I can't save the file as i dont have permission. Anyone have any tips? |
| QUOTE Thanks | |
![]() Member Since: Apr 09, 2009
Location: Ithaca NY
Posts: 2,073
![]() ![]() ![]() ![]() Mac Specs: 13 inch alMacBook 2GHz C2D 4G DDR3, 1.25GHz G4 eMac
|
|
| QUOTE Thanks | |
![]() Member Since: Oct 19, 2008
Location: Ottawa
Posts: 15,455
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 2012 13" MBP (2.5 i5, 8GB)
|
Just a tip - you shouldn't be using Python's SimpleHTTPServer for anything serious (I'm not saying you are though).
A much easier solution would be to simply write a small server in Python using SimpleHTTPServer and run that from a directory that you have permissions to. Using Python's docs to help me here (I'm largely unfamiliar with the SImpleHTTPServer module), create a file called <something>.py (replace <something> with whatever you want) and make the contents of the file the following: Code:
import SimpleHTTPServer
import SocketServer
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever()
Code:
python <something>.py Important Links: Community Guidelines : Use the reputation system if you've been helped. M-F Blog :: Write for the blog :: M-F IRC Channel - Chats every Sunday at 8PM EST. |
| QUOTE Thanks | |
| Post Reply | New Thread | Subscribe |
| Thread Tools | |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|
|||||||
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| My MacBook Pro and creating an archive (zip) file | Lsrichards | Apple Notebooks | 7 | 02-10-2011 04:49 AM |
| how do you edit file properties in snow leopard | converted | OS X - Operating System | 6 | 09-05-2010 08:59 AM |
| InDesign won't let me edit original file | groutster | OS X - Apps and Games | 0 | 03-05-2010 12:54 PM |
| How Can You Edit "Get Info" Of a File? | MacUser_88905 | OS X - Operating System | 8 | 07-26-2009 01:19 AM |
| How best can I Edit this file??? | topdog99 | Music, Audio, and Podcasting | 6 | 05-07-2008 02:01 PM |
All times are GMT -4. The time now is 10:08 AM.
Powered by vBulletin