Vweb is a Simple Python Website Frame work.
Source: https://github.com/dlink/vweb
It has been created over a time to address reoccuring requirements for building simple websites. It is Python CGI, but can be used with Cherrypy. It is not MVC. It consists of the following modules:
Modules
-
HtmlPage - Super class that controlls the processing and display of webpages
-
html - HTML Abstraction layer for generating HTML
-
HtmlTable - HTML Table Abstraction layer for generating HTML Tables
-
htmlify - Some utilities
-
examples - Examples
Details
HtmlPage
HtmlPage is a Web Page that your code subclasses. It consists primarily of
-
A Constructor init() which you override, which allows you to dynamically build the HTML HEADER with Title, Javascript, CSS, auto_refesh, output_format (html, csv)
-
A process() method which you overide for handling incoming GET and POST parameters.
-
A getHtmlContent() method which you overrid for generating HTML BODY
-
Debugging GET and POST Variables, as well as user defined DEBUG message.
Here is Hello World:
from htmlpage import HtmlPage
class HelloWorld(HtmlPage):
def __init__(self):
HtmlPage.__init__(self, "Hello World")
def getHtmlContent(self):
return '<p>Hello, World!</p>'
if __name__ == '__main__':
HelloWorld().go()
See Other Examples
html
html is a libary module of simple one-to-one python equivalent names for each HTML tag. It is used to generate html in python, rather than using templates like Genshi, or PHP.
The following examples ...
b('hi')
p(font('some text', color='green'))
a('Chapter 2', href='chapter2.html')
div(center(column_chooser), id='columnChooser', class_='widget')
Returns these string:
<b>hi</b>
<p><font color='red'>text</font></p>
<a href='chapter2.html'>Chapter 2</a>
<div id="columnChooser" class="widget">
<center>
< … >
</center>
</div>
HtmlTable
HtmlTable is an Abstraction layer for HTML TABLES, (and it rocks the house). It was inspired by perl's HTML:Table.
By treating tables as Python objects similar to a list of lists, uses can work more freely and creatively, leaving the output of the HTML TABLE to the getTable() method.
This example …
from htmltable import HtmlTable
# Create table - Many parameter options exist.
table = HtmlTable()
# Header
table.addHeader(['No.', 'President'])
# Table Body
table.addRow([1, 'George Washington'])
table.addRow([2, 'John Adams'])
# Format adjustments
table.setColAlign(2, 'right')
# Outputing the results
print table.getTable()
Output the following
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>No.</th>
<th align="right">President</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td align="right">George Washington</td>
</tr>
<tr>
<td>2</td>
<td align="right">John Adams</td>
</tr>
</tbody>
</table>
Examples
See Examples
Requires
vlib - https://github.com/dlink/vlib
Installation
Installation
Ubuntu
Update apt-get to the latest libraries:
apt-get update
Install pip, if you haven't done so already:
apt-get install python-pip
pip install -U pip
Install Mysql DB Connectorm, if you haven't done so already:
apt-get install python-dev libmysqlclient-dev
pip install MySQL-python
Install vlib:
pip install vweb
Metadata
Release files for vweb 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vweb-2.0.0.tar.gz | 23.5 kB | Without provenance | Details for vweb-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vweb-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for vweb-2.0.0-py3-none-any.whl |
Total release size: 46.2 kB
Release files / vweb-2.0.0.tar.gz
| Download URL | vweb-2.0.0.tar.gz |
|---|---|
| Size | 23.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a42d6ec4ae2b964e0f148d710065752fa62b0d14b70fca7f785fb166745e609
|
|
BLAKE2b-256 checksum How to use checksums |
614528d6d4dd404d583b5bf50028ca5c793b493c6948ee8242a36081c6b18967
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|
Release files / vweb-2.0.0-py3-none-any.whl
| Download URL | vweb-2.0.0-py3-none-any.whl |
|---|---|
| Size | 22.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b423d3e8aeef5bac2971e94967a4645c87d043409f47015467f4b460407ee65
|
|
BLAKE2b-256 checksum How to use checksums |
094b002ad615f8a90405e179f6510a4d96ce56f8bd5fdf5193a1b5a23d40191f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|
Security for vweb 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.