Made by tygzy – https://github.com/tygzy
A class for the Bottle API to reduce clutter and difficulty while creating a website.
Summary of features:
- When adding a file to your html file e.g. CSS you only need to provide the filepath past the ‘css’ directory, if the css file is in that main directory you only need to provide the file name.
- This is the same if you use a file inside your CSS e.g. an svg reference you only need to provide the file name unless the file is embedded further in the directory.
- This is also the case for other file types such as
.js .css .scss .svg .jpg .png .ttf .eot .ttf .woff .woff2.
- All basic website directories will be made when you call the class for the first time if the directories don’t already exist.
- To use sessions(cookies) the ‘enable_sessions()’ function, this needs to be called otherwise sessions won’t be enabled.
- For allowing a user to download a file make a link with the route ‘/download/’.
- When uploading a file to the web server, it will automatically upload to
- The base class also allows the use of SQLite3 with ease, requiring no setup, just use the
return_SQL()functions to interact with your database.
- A function that allows the creation of a UUID, which checks in a provided table whether that UUID already exists to make sure it is unique.
<div class="snippet-clipboard-content position-relative overflow-auto" data-snippet-clipboard-copy-content="class Website(object):
debug = True
reload = True
port = 8080
host = " localhost" self.astatine="Astatine(host," port, debug, reload) self.astatine.enable_sessions() self.create_routes() def create_routes(self): self.astatine.add_route(' ', 'get', self.index, true) self.astatine.add_error_handler(404, self.error_page) index(self, session): return template('html index.tpl', session="session)" error_page(self, error): "