Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Refactor setup
  • Loading branch information
EliuX committed Mar 10, 2020
commit 3b026af7b07d570875a3dddd274c47c7df604a65
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,7 @@ __pycache__/
.idea

# virtual environments
.venv
.venv

# Files generated for development
.env
45 changes: 36 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,39 @@
# time-tracker-api

## Set new environment in Windows
- `mkdir .venv`
- `python -m venv .venv`
- `.venv\Scripts\activate.bat`
- `pip install -r requirements/prod.txt`

## Example usage in Windows
- `export FLASK_APP=time_tracker_api` or `set FLASK_APP=time_tracker_api`
- `flask run`
## Setup

- Create and activate the environment,

In Windows:

```
python -m venv .venv
.venv\Scripts\activate.bat
```

In Unix based operative systems:
```
virtualenv .venv
source .venv/bin/activate
```
- Install the requirements:
```
python3 -m pip install -r requirements/prod.txt
```
Remember to do it with Python 3.

## How to use it
- Set the env var `FLASK_APP` to `time_tracker_api` and start the app:

In Windows
```
set FLASK_APP=time_tracker_api
flask run
```
In Unix based operative systems:
```
export FLASK_APP=time_tracker_api
flask run
```

- Open `http://127.0.0.1:5000/` in a browser
2 changes: 0 additions & 2 deletions requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ Flask==1.1.1
flask-restplus==0.13.0
flake8==3.7.9
Werkzeug==0.16.1
wrapt==1.11.2
zipp==3.1.0
gunicorn==20.0.4
2 changes: 1 addition & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
from time_tracker_api import create_app

app = create_app()
print("BPM Projects API server was created")
print("BPM Projects API server was created")
2 changes: 1 addition & 1 deletion time_tracker_api/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ class InvalidMatch(Exception):
"""
Errors related to an invalid match during a search
"""
pass
pass
2 changes: 1 addition & 1 deletion time_tracker_api/projects/projects_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ def matches_search_string(search_str, project):

# Instances
# TODO Create an strategy to create other types of DAO
project_dao = InMemoryProjectDAO()
project_dao = InMemoryProjectDAO()