docker-compose up --build -d
.docker container exec meep-backend_api_1 python /meep/api/src/db_operations.py reset dev
. You should only need to do this the first time you run the app.localhost/api/locations
. If you see a bunch of json data, it worked!docker container exec -it meep-backend_db_1 psql -U meep -h meep-backend_db_1 -d meep_api
password: supersafe
docker container exec -it meep-backend_api_1 /bin/ash
docker container exec -it meep-backend_web_server_1 /bin/bash
docker logs meep-backend_web_server_1
docker build -t meep-backend:gunicorn src
Create and run a container from the image:
docker run -p 8001:8000 meep-backend:gunicorn
or to allow live editing of the code in the container, do
docker run -p 8001:8000 -v $(pwd)/src:/meep/api/src meep-backend:gunicorn
$(pwd)/src
on the left side of the bind mount, you will have to provide an absolute path to the project folder that contains the Dockerfile (src at the time of writing). After that, there is a chance that you will get a different error. Restart docker and try again. It usually works on the second attempt. Please note that this is a temporary workaround while we find a less annoying way to run the project on windows. http://localhost:8001/locations
to see
if it worked.Install python
sudo apt-get install python3
sudo apt install virtualenv
clone the master branch
git clone git@github.com:codeforkansascity/meep-backend.git
move into project root directory
cd meep-backend
create a virtual environment in the project root directory
virtualenv venv
activate the virtual environment
source venv/bin/activate
pip install requiremnets
pip install -r src/requirements.txt
Install sqlite3
sudo apt install sqlite3
create a sqlite database touch dev.db
set dev database environment variable export DEV_DATABASE_URL=sqlite:///dev.db
Open the database in sqlite with sqlite3 dev.db;
check to see if it created the tables with .tables
try to display data from a table select * from projects;
you should see a list of projects display
set flask environment variable to development
export FLASK_ENV=development
Set flask app environment variable
export FLASK_APP="src/app:create_app()"
run the app
flask run
test to see if it worked: in a browser, type localhost:5000/projects
you should see some json containing project data
venv\Scripts\activate
pip install -r requirements.txt
set DEV_DATABASE_URL=sqlite:///dev.db
set FLASK_ENV=development
set FLASK_APP=src\app.py
flask run
localhost:5000/projects
you should see some json containing project datadocker-compose up --build -d
docker exec -it meep-backend_api_1 pytest
docker container exec -it meep-backend_api_1 /bin/ash
) and then enter the pytest
command
pytest -v
pytest ../tests/unit
pytest ../tests/unit/test_models.py
pytest ../tests/unit/test_models.py::test_insert_location
meep
shell script in the root directory for some shorter ways of running some of these commands with either the shell script itself or by copying the shorthand aliases into your dev environment.