A micro web framework
Project description
webgo
Webgo is a micro web framework.
It addresses a couple of problems:
-
Mapping URL to objects
-
Loading static files
-
Performing DB operations through ORM
Requirements
Python 3.6+
Installation
$ pip3 install webgo
Quickstart
There is a simple implementation in demo directory, You can imitate it to build your own.
run
$ webgo demo
and access: http://localhost:8080
note: the work directory must be the same as project
More
Project Structure
You must construct project structure like this:
And import all .py files in __init__.py
.
├── __init__.py
├── app.py
├── model.py
├── static
│ ├── css
│ │ └── demo.css
│ └── js
│ └── demo.js
└── templates
└── index.html
Object Mapping
You can map any URL to any function.
from webgo.handler import get
@get('/')
def hello(request):
return 'hello world'
ORM
You can save and query data through sqlite by orm.
>>> from webgo.orm import IntegerField, TextField, Model
>>> class Demo(Model):
>>> age = IntegerField('age')
>>> name = TextField('name')
>>> Model.create_table()
Table Demo created
>>> one = Demo(age=12, name='Bob')
>>> one.age = 15
>>> one.save()
>>> one.pk
>>> 1
>>> one.age
>>> 15
>>> Demo(age=10, name='Tom').save()
>>> recset = Demo.objects.query()
>>> print(recset)
<Demo RecorcdSet (1,2)>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file webgo-0.14.0.tar.gz.
File metadata
- Download URL: webgo-0.14.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eface507a4b13515cd25d52625114efbbe522d146fbe3609e4d268f397c43082
|
|
| MD5 |
aacb351beb95f0e2a414d2fc88c6f622
|
|
| BLAKE2b-256 |
150f84a40619f7bb576f989c1e979a925eb2d2237658d9767d4dfaad8546bdcc
|
File details
Details for the file webgo-0.14.0-py3-none-any.whl.
File metadata
- Download URL: webgo-0.14.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48f07f91f2084a604a19d1f5a1a1f4d7d6b33390e6731fec1ef2b6b45bf04523
|
|
| MD5 |
345f1b579206c3a62573893baac9a2c8
|
|
| BLAKE2b-256 |
4465bd123f83816bd745e67e327742db63f4d2172d42dd0fb2154604fd65536c
|