A webserver to use when you have no time for configuration
Project description
Webserver to go
Get started
First, take a look at the example app, found here.
Features
Easily display your pages
This library supports all displaying images, videos, HTML/CSS and JavaScript files. The example website is built using Bootstrap.
[!IMPORTANT]
All HTML/CSS/JS and other media files shouild be stored incontent/.
Code templates
<table id="gbentries-table" border = "1">
<tr>
<th>ID</th>
<th>Username</th>
<th>Comment</th>
<th>Posted on</th>
</tr>
{{customcontent}}
{{for gbentry in gbrepo}}
<tr>
<td>{{gbentry.id}}</td>
<td>{{gbentry.username}}</td>
<td>{{gbentry.comment}}</td>
<td>{{gbentry.posted_on}}</td>
</tr>
{{endfor}}
{{endcustomcontent}}
</table>
Notice the {{customcontent}} and {{endcustomcontent}} tags? They represent the beginning, respectively the end of the area of code that contains custom content. Inside, there is a loop which iterates over a list of objects and displays some of its attributes on the screen.
The resulting HTML content is this:
- TODO add code
And the result on the user's screen is this:
- TODO add pic
No boilerplate for repositories!
from built_to_serve_arazi47.repository import Repository
class GuestBookRepository(Repository):
pass
This is all you need to have a fully functioning repository (except the DTO, of course) The following methods are already implemented: save, update, fetch_all, delete_by_id. The data is stored using an SQL database.
[!IMPORTANT] Be aware that you need to create a
Modeland have its repository namedModelRepository, i.e for a class namedUser, its corresponding repository must beUserRepository.
Easily create routes
Routes can be easily created using @route("path/to/file").
@route("/")
@route("/index.html")
class Index(BaseView):
def __init__(self, file_path, status_code=200, content_type="text/html") -> None:
super().__init__(file_path, status_code, content_type)
def build_GET_response(self) -> str:
with open(self.file_path) as f:
return f.read()
The get response is as basic as it gets: it opens and displays the page located at file_path.
Project details
Release history Release notifications | RSS feed
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 ws2g-0.1.0.tar.gz.
File metadata
- Download URL: ws2g-0.1.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.3 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1875c57581a3fa54e588d45788f7e52ee4b6b3ed0510a14f3b3dfc8dd82c39c
|
|
| MD5 |
822edd6c33a809a21cc27f835bcdda6e
|
|
| BLAKE2b-256 |
1ccf121f609b3b49a2f285e0a31bbfe3a868d1cb47f24acf0e263f6ce7af6908
|
File details
Details for the file ws2g-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ws2g-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.3 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c20b006330d7075a448caa9db32840258741a3c97664f30a613bb51404bd4f12
|
|
| MD5 |
4957319b01d9ce142d0a14bfc7e24fa2
|
|
| BLAKE2b-256 |
b59a057c704b3b9c9daef522be0204ee09d5c09541db73f5248b6feb99b9d41f
|