90 lines
1.8 KiB
Markdown
90 lines
1.8 KiB
Markdown
# DevBox Landing Page
|
|
|
|
Git repository for frontend and backend for the DevBox landing page and email collection service.
|
|
|
|
## Development Setup
|
|
|
|
### Set up development environment with Python venv
|
|
|
|
We use pythons built in module, venv, to create an isolated python environment.
|
|
|
|
[Python Documentation for virtual environments][0]
|
|
|
|
#### Initialize the virtual environment
|
|
|
|
The following command initializes the virtual environment in the `.venv/`-dirctory
|
|
|
|
```shell
|
|
python3 -m venv .venv
|
|
```
|
|
|
|
Then you use one of the following commands to activate the virtual environment in your current shell session
|
|
|
|
##### Bash
|
|
|
|
```shell
|
|
source .venv/bin/activate
|
|
```
|
|
|
|
##### Fish
|
|
|
|
```shell
|
|
source .venv/bin/activate.fish
|
|
```
|
|
|
|
##### Install python modules
|
|
|
|
Now you can install the python modules for this project with the following command
|
|
|
|
```shell
|
|
pip3 install -r requirements.txt
|
|
```
|
|
|
|
##### Add a new module to requirements.txt
|
|
|
|
Run the following commands to install a new module and add it to the `requirements.txt`-file.
|
|
|
|
In this example we install the `SQLAlchemy`-module.
|
|
|
|
```shell
|
|
pip3 install SQLAlchemy
|
|
python3 -m pip freeze > requirements.txt
|
|
```
|
|
|
|
##### Upgrade pip3 modules
|
|
|
|
###### List outdated modules
|
|
|
|
```shell
|
|
pip3 list --outdated
|
|
```
|
|
|
|
###### Upgrade all outdated modules
|
|
|
|
```shell
|
|
pip3 list -o | cut -f1 -d' ' | tr " " "\n" | awk '{if(NR>=3)print}' | cut -d' ' -f1 | xargs -n1 pip3 install -U
|
|
```
|
|
|
|
###### Save changes to requirements.txt
|
|
|
|
```shell
|
|
python3 -m pip freeze > requirements.txt
|
|
```
|
|
|
|
### Building and running with Docker or Podman
|
|
|
|
#### Docker
|
|
|
|
```shell
|
|
docker build -t devbox-back:latest .
|
|
docker run --rm -it -p "8000:8000" -v './db:/usr/src/app/db' devbox-back:latest
|
|
```
|
|
|
|
#### Podman
|
|
|
|
```shell
|
|
podman build -t devbox-back:latest .
|
|
podman run --rm -it -p "8000:8000" -v './db:/usr/src/app/db' devbox-back:latest
|
|
```
|
|
|
|
[0]: https://docs.python.org/3/library/venv.html |