A Python web server that delivers content within a directory.
This webserver technically supports any OS as long as it can run Python and Gunicorn; however, the shell scripts are designed with Linux users in mind. I'm a Linux user myself and I don't have the time or resources to design the shell scripts for operating systems outside of GNU/Linux.
Written with Linux in mind
Note: the main.py file contains code to run the development Flask server. DO NOT USE RUN IT DIRECTLY. Flask is NOT intended for production. Use Gunicorn instead. In order to discourage Flask usage, there will not be any way to configure the Flask webserver without hard-coding.
The dependencies can be found in the requirements.txt file.
- Clone this repository with
git clone https://gitlab.lettsn.org/Lett/contentdeliveryserver# - CD into the root directory
- Run
chmod +x run_server.sh - Run
./run_server.sh [port], where[port]is the port you want to use. - A Gunicorn webserver using all threads of your CPU should start.
Keep in mind that the webserver won't automatically start on system boot. You will need to set up a systemd service. Example of a systemd service:
[Unit]
Description=Content Delivery Server
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=on-failure
RestartSec=1
User=lett
ExecStart=/home/lett/PycharmProjects/ContentDeliveryServer/run_server.sh 7010
[Install]
WantedBy=multi-user.targetWhen you run the webserver via the run_server.sh script, an auto-updater will start that will pull from the repository
every hour. Keep in mind that it won't actually download anything unless there are any changes to download.
The WSGI itself can be configured via a .ini file. If you setup the CDS_CONFIG_ROOT, then it will use the
configuration in that given folder. However, if you leave it blank, then it will default to the cds_config folder in
the root directory of the cloned repository.
Below is the template that all configuration files follow:
[category]
name = value
| Name | Description | Type | Default |
|---|---|---|---|
| allow_folder_access | Whether folders can be transversed. | bool | false |
| hidden_files | Whether files can be hidden with .[file_name]. |
bool | true |
Example of access category
[access]
allow_folder_access = true
hidden_files = true