Skip to content

taedmonds/python-web-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Python Web Server (Socket Programming)

This is a simple web server developed with python sockets. Server is compatible of serving various file types and also supports serving multiple clients at once.

The server also support simple GET and POST form submissions.

Example links

Type Route
.html /
.php /contact.php
.css /style.css
.js /script.js
.jpg /images/parallax1.jpg
.json /files/sample.json
.xml /files/sample.xml
.txt /files/sample.txt
.pdf /files/sample.pdf
.xlsx /files/sample.xlsx

Requirements

  • PHP 8.2.4 or up ( php -v for version )
  • Python3 ( python -v for version )
  • NodeJs (node -v for version ) [ optional ]

Usage

Create a folder named as htdocs in the root directory, and add the web files to it.

Than, to start the server, Run the below code.

python serve.py

For Development

If you have NodeJs installed, use npm and nodemon to start the server.

npm install # install node modules

To run the server

npm start # run the server
npm run dev # run the server in development mode

Now open the browser and head over to localhost:2728.

About

A simple web server developed with python sockets.

Topics

Resources

Stars

Watchers

Forks

Contributors