A python module is a file suffixed with .py. Python modules are translated to binary instructions; the instructions are executed by the computer. A python module may import other python modules. A python virtual environment stores python modules imported by the python module to be executed. tinyshop executes app.py. An example of an imported set of modules is flask.
tinyshop/client/assets
.tinyshop/server
.wget https://tinyshops.org/assets/offering.csv
to get the offering.csv template.wget https://tinyshops.org/assets/example-offering.csv
to get a populated example of offering.csv.wget https://tinyshops.org/assets/config.json
to get the config.json template.domain.org
with the root domain.key
with the secret key.secret
with the signing secret.country
with the two-letter ISO country code of the country to which you ship. Valid countries are here. If you ship to multiple countries, do so like the following ["country", "country2"].x
with the shipping amount for each order in US cents. For example, if the order shipping amount is $7.50, set "SHIPPING_AMOUNT" to 750.git add .
to add the files to the staging area.git commit -m "Configure private tinyshop repository."
to commit the files to the repository.git push origin master
to push the commit to the GitHub private tinyshop repository.git clone https://github.com/user/tinyshop.git
, replacing user
with the GitHub username.git config --global user.email "email"
replacing email
with the GitHub no-reply email address or the domain email address.git config --global user.name "name"
replacing name
with the GitHub username.python3 --version
to confirm python3 is installed.mkdir venv
to create the virtual environment directory; change to the directory.sudo apt install python3.x-venv
replacing x
with the version of python3 installed on the server. python3 -m venv tinyshop
to name the virtual environment tinyshop.source tinyshop/bin/activate
to activate the virtual environment.python3 -m pip install -r requirements.txt
to install the required python modules. python test.py
to execute the test.py Python module; test.py stores unit tests of tinyshop. The shell should log Tests passed in x seconds
.python administrate.py
. In this instance, administrate.py validates config.json, creates the database, and sets the database offers to those stored in offering.csv.sudo snap install --classic certbot
to install certbot using snap. See rationale for using the snap package manager here. sudo certbot certonly --nginx --domain domain.org
replacing domain.org
with the root domain to generate the TLS certificate and key.sudo rm default.conf
to remove the default server configuration file.sudo touch domain.conf
replacing domain
with the domain to create the domain server configuration file.domain.org
with the root domain.
server {
listen 80;
server_name domain.org;
return 301 https://domain.org$request_uri;
}
server {
listen 443 ssl;
server_name domain.org;
ssl_certificate /etc/letsencrypt/live/domain.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.org/privkey.pem;
root /home/user/tinyshop/client;
location / {
index index.html;
}
location /server/ {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
sudo systemctl reload nginx
to reload nginx, thus applying the configuration changes. tmux
to create a tmux session.python app.py
to run tinyshop.