Skip to content

A simple webapplication with Python web.py and the HTML-Template Bootstrap

License

Notifications You must be signed in to change notification settings

GrimbiXcode/simpleWebPy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simpleWebPy

A simple example web application with Python web.py and the Bootstrap 3 framework.

Included functions

  • XMLHttpRequest
  • Worker-Thread with message-queue
  • simple chat function
  • flot-live-chart

This is the "index"-page of the SimpleWebPy-Site. It contains a very simple made chat:

Image of Chat in SimpleSite

Here you can see a chart made with flot. It shows the cpu ussage of the server cpu in percent.

Image of Chart in SimpleSite

Installation

Required Python modules

  • web.py
  • psutil

Windows

If you need pip type python get-pip.py in your command promt.

python -m pip install web.py
python -m pip install psutil

If you are working behind a proxy server:

Put in your command promt (cmd): netsh winhttp show proxy

Copy the given proxyHost and port and paste it into the command: SET HTTPS_PROXY=<proxyHost>:<proxyPort>

Now you should be able to use pip as written above.

Linux Ubuntu

If you need pip type python get-pip.py in your terminal.

pip install web.py
pip install psutil

Download .zip from latest release

Latest Release:

Extract it to the directory you want to start the website from. For example: \home\john\web\

Start the application

Now start your simpleSite with the command:

Windows

python \home\john\web\SimpleWebPy\simpleSite\processor\SimpleSiteApp.py

Linux

python /home/john/web/SimpleWebPy/simpleSite/processor/SimpleSiteApp.py

Stopp the application

Windows and Linux

Press ctrl + c in your commandline or terminal to stop the web application.

Note: You have to close all sessions (open internet browser) to close the script with ctrl + c. Otherwise, the web.py application and the "input"-thread prohibits the close process.

You can also kill the python process, but I do not recommend this way.

Overview

Directory structure of the project

/simpleSite
│
├───/html_public
│   │
│   └───/pages                      # Save your HTML-files in this folder
│       │
│       ├───base.html               # One of the HTML-file
│       ├───index.html              # One of the HTML-file
│       ├───serverussage.html       # One of the HTML-file
│       └───/Bootstrap Templates    # Original Bootstrap-files
│
├───/lib_systemd_system
│   │
│   └───simplesite.service          # Service-file for systemd controlled autostart
│
└───/processor
    │
    ├───/sessions                   # Generated by wep.py to save session-data
    │
    ├───/static                     # folder for static files like .js .css .less etc.
    │   │
    │   ├───/data                   # folder for your js-Files to print charts
    │   │	│
    │   │   ├───chart.js            # javascript to handle a simple chat
    │   │   └───cpu-live-data.js    # javascript to print the cpu ussage in a chart
    │   │
    │   └───...                     # Other files used by the bootstrap framework
    │
    └───simpleSiteApp.py            # python-script of your web application

Explanaition of used AJAX

The following diagram shows you, how the AJAX request in the chat works.

Diagram to explain XMLrequest

The same principle is used in the page serverussage.

References

About

A simple webapplication with Python web.py and the HTML-Template Bootstrap

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published