Skip to content

Commit 3b026af

Browse files
author
EliuX
committed
Refactor setup
1 parent 667d626 commit 3b026af

File tree

6 files changed

+43
-15
lines changed

6 files changed

+43
-15
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ __pycache__/
1616
.idea
1717

1818
# virtual environments
19-
.venv
19+
.venv
20+
21+
# Files generated for development
22+
.env

README.md

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,39 @@
11
# time-tracker-api
22

3-
## Set new environment in Windows
4-
- `mkdir .venv`
5-
- `python -m venv .venv`
6-
- `.venv\Scripts\activate.bat`
7-
- `pip install -r requirements/prod.txt`
8-
9-
## Example usage in Windows
10-
- `export FLASK_APP=time_tracker_api` or `set FLASK_APP=time_tracker_api`
11-
- `flask run`
3+
## Setup
4+
5+
- Create and activate the environment,
6+
7+
In Windows:
8+
9+
```
10+
python -m venv .venv
11+
.venv\Scripts\activate.bat
12+
```
13+
14+
In Unix based operative systems:
15+
```
16+
virtualenv .venv
17+
source .venv/bin/activate
18+
```
19+
- Install the requirements:
20+
```
21+
python3 -m pip install -r requirements/prod.txt
22+
```
23+
Remember to do it with Python 3.
24+
25+
## How to use it
26+
- Set the env var `FLASK_APP` to `time_tracker_api` and start the app:
27+
28+
In Windows
29+
```
30+
set FLASK_APP=time_tracker_api
31+
flask run
32+
```
33+
In Unix based operative systems:
34+
```
35+
export FLASK_APP=time_tracker_api
36+
flask run
37+
```
38+
1239
- Open `http://127.0.0.1:5000/` in a browser

requirements/prod.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@ Flask==1.1.1
22
flask-restplus==0.13.0
33
flake8==3.7.9
44
Werkzeug==0.16.1
5-
wrapt==1.11.2
6-
zipp==3.1.0
75
gunicorn==20.0.4

run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
from time_tracker_api import create_app
66

77
app = create_app()
8-
print("BPM Projects API server was created")
8+
print("BPM Projects API server was created")

time_tracker_api/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ class InvalidMatch(Exception):
1616
"""
1717
Errors related to an invalid match during a search
1818
"""
19-
pass
19+
pass

time_tracker_api/projects/projects_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,4 @@ def matches_search_string(search_str, project):
7777

7878
# Instances
7979
# TODO Create an strategy to create other types of DAO
80-
project_dao = InMemoryProjectDAO()
80+
project_dao = InMemoryProjectDAO()

0 commit comments

Comments
 (0)