A project by Almir Paulo
This is a simple CLI to serve a basic web server. This web server is not intended to be a production server, but a development one. The idea is to help developers to test and share their applications with their team partners or even with someone who have hired you for a job and wants to take a look at their product.
I know... I know... there are a lot of options out there to do the same. But this one is 100% free, easy and has a lot of features you may like.
- As a temporary deploy for your app, so you can show it to your partners.
- As a Flask Boiler Plate.
- As your home server.
- As a learn resource for Flask, Python and Backend.
- Deploy of a single page. (Ideally, a temporary deploy)
- SQL database included (SQLite3 by default, but you can easily change it).
- Jinja2
- Bootstrap 5 locally installed, to make your Frontend life easier.
- For advanced usage (like APIs, authentication, etc), you can paste your own backend features on the "myapp.py" file.
- Python3
- Flask
- Flask-SQLAlchemy
I have plans to automate this whole process in a shell script.
-
Clone this repo.
-
Make sure you have Python3 installed
-
Create a virtual environment (optionally, but recommended).
python3 -m venv venv
-
Activate the virtual environment and install the requirements.
source venv/bin/activate pip install -r requirements.txt
If you have choosen to skip step 3, paste just the second command, obviously.
If you have pipenv installed you can, of course, use the pipenv way of install the requirements instead of steps 4 and 5.
-
Paste this line on your .bashrc. If you have not a .bashrc file, create it. The following line just create an alias. You can do this with a text editor like "nano" or "vim", or just use "touch" and "echo" commands.
alias sdst='python3 ~/skeleton_dev_server/run.py'
-
It's Ready! To make sure it's running all good, simply run:
sdst
You should see the welcome page at 127.0.0.1:5001.
All the commands are optionals.
usage: run.py [-h] [--host HOST] [--port PORT] [--page PAGE]
A Webserver CLI for development purposes.
optional arguments:
-h, --help show this help message and exit
--host HOST The host where the webserver would run.
--port PORT The port where webserver would run
--page PAGE, -p PAGE The page to be rendered
Default host is localhost (127.0.0.1) and default port is 5001.
In order to run an html page, you just need to place it in the templates directory and run the cli with the "--page" option or simply "-p". This server can handle Jinja2 templates and if you need to run static files, place them in the "/static" directory inside the server folder.
Please, open an Issue here on Github.
Pull request me! Fork it! Tell people about it! Buy me a coffee! (button soon!)
- Enable deploy of multiple pages
- Installation via pip
- Shell script for installation
- Include Redis
- Command for save logs
- A tests file for TDD lovers.
- Configure a database panel interface.
- Make it available for Android
First release.
New way to choose host.