Magicweb
Magicweb is a simple web framework that is still under developement. It currently supports route parameters and html templating but not template ineritance.
Usage
Installation
To install Magicweb you can run
pip install Magicweb or pip3 install Magicweb
To install Magicweb from source run
git clone https://github.com/mordy-python/magicweb
cd magicweb
python setup.py install
Run a basic app
To create a simple app we need to import Magicweb and create an app instance we need to add the __file__ variable to the app instance.
import magicweb
app = magicweb.Magicweb(__file__)
Once our app is instantiated we can add routes
import magicweb
app = magicweb.Magicweb(__file__)
@app.route('/')
def index(request, response):
response.text = "Hello"
@app.route('/rendered')
def rendered(request, response):
app.render('index.html')
We created two routes, one that returns hello world, and one that renders an html page. All html pages should be in a directory named html, although this can be overrdden when instantiting the App class.
To run our app we need to use the app.run() function
...
run(app)
# to run with a different host/port just add those arguments
# run(app, host='0.0.0.0', port=5000)
We can also create routes with parameters
import magicweb
app = magicweb.Magicweb(__file__)
@app.route('/{name}')
def index(request, response, name):
response.text = "hello " + name
Release files for Magicweb 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Magicweb-2.0.3.tar.gz | 3.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Magicweb-2.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.5 kB
Release files / Magicweb-2.0.3.tar.gz
| Download URL | Magicweb-2.0.3.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
32bc918cfb742e025a1cc2137a5f780901cb3e4994ccd98402465c71fca79f2f
|
|
BLAKE2b-256 checksum How to use checksums |
5add0f11eb998e29fabb3f4f1759cdd257cdee0c3f53f3686c8a9c2ad07545af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.5
|
Release files / Magicweb-2.0.3-py3-none-any.whl
| Download URL | Magicweb-2.0.3-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9639a376ee09eda9013c40c903d2a8a728131084e6b52eea36a7243a947d3c5d
|
|
BLAKE2b-256 checksum How to use checksums |
425097eb8811976953da2fecb8c6a5787eb0fa599492e7242a8edec9e5d2ed56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.5
|