Skip to content

Commit 67df617

Browse files
committed
Added easy-install Makefile and updated README.md.
1 parent 5ff840a commit 67df617

File tree

19 files changed

+362
-429
lines changed

19 files changed

+362
-429
lines changed

Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
SRCPATH := $(CURDIR)
2+
PROJECTNAME := $(shell basename $(CURDIR))
3+
4+
define HELP
5+
Manage $(PROJECTNAME). Usage:
6+
7+
make run - Run $(PROJECTNAME).
8+
make deploy - Install requirements and run app for the first time.
9+
make update - Update pip dependencies via Python Poetry.
10+
make format - Format code with Python's `Black` library.
11+
make clean - Remove cached files and lock files.
12+
endef
13+
export HELP
14+
15+
.PHONY: run deploy update format clean help
16+
17+
18+
requirements: .requirements.txt
19+
env: .venv/bin/activate
20+
21+
22+
.requirements.txt: requirements.txt
23+
$(shell . .venv/bin/activate && pip install -r requirements.txt)
24+
25+
26+
all help:
27+
@echo "$$HELP"
28+
29+
30+
.PHONY: run
31+
run: env
32+
$(shell . .venv/bin/activate && flask run)
33+
34+
35+
.PHONY: deploy
36+
deploy:
37+
$(shell . ./deploy.sh)
38+
39+
40+
.PHONY: update
41+
update: env
42+
.venv/bin/python3 -m pip install -U pip
43+
poetry update
44+
poetry export -f requirements.txt --output requirements.txt --without-hashes
45+
46+
47+
.PHONY: format
48+
format: env
49+
$(shell . .venv/bin/activate && isort -rc ./)
50+
$(shell . .venv/bin/activate && black ./)
51+
52+
53+
.PHONY: clean
54+
clean:
55+
find . -name '*.pyc' -delete
56+
find . -name '__pycache__' -delete
57+
find . -name 'poetry.lock' -delete
58+
find . -name 'Pipefile.lock' -delete

Pipfile

Lines changed: 0 additions & 19 deletions
This file was deleted.

Pipfile.lock

Lines changed: 0 additions & 230 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,44 +13,14 @@
1313
Structure your Flask apps in a scalable and intelligent way using Blueprints.
1414

1515
This repository contains source code for the accompanying tutorial on Hackers and Slackers: https://hackersandslackers.com/flask-blueprints/
16-
1716
A live demo of this repository can be found here: https://flaskblueprints.hackersandslackers.app/
1817

1918

20-
## Installation
21-
22-
**Installation via `requirements.txt`**:
23-
24-
```shell
25-
$ git clone https://github.com/hackersandslackers/flask-blueprint-tutorial.git
26-
$ cd flask-blueprint-tutorial
27-
$ python3 -m venv myenv
28-
$ source myenv/bin/activate
29-
$ pip3 install -r requirements.txt
30-
$ flask run
31-
```
32-
33-
**Installation via [Pipenv](https://pipenv-fork.readthedocs.io/en/latest/)**:
19+
# Installation
3420

35-
```shell
36-
$ git clone https://github.com/hackersandslackers/flask-blueprint-tutorial.git
37-
$ cd flask-blueprint-tutorial
38-
$ pipenv shell
39-
$ pipenv update
40-
$ flask run
41-
```
21+
Get running locally in two steps:
4222

43-
**Installation via [Poetry](https://python-poetry.org/)**:
44-
45-
```shell
46-
$ git clone https://github.com/hackersandslackers/flask-blueprint-tutorial.git
47-
$ cd flask-blueprint-tutorial
48-
$ poetry shell
49-
$ poetry update
50-
$ poetry run
51-
```
52-
53-
## Usage
23+
## Environment Variables
5424

5525
Replace the values in **.env.example** with your values and rename this file to **.env**:
5626

@@ -65,6 +35,16 @@ Replace the values in **.env.example** with your values and rename this file to
6535

6636
*Remember never to commit secrets saved in .env files to Github.*
6737

38+
## Installation
39+
40+
Get up and running with `make deploy`:
41+
42+
```shell
43+
$ git clone https://github.com/hackersandslackers/flask-blueprint-tutorial.git
44+
$ cd flask-blueprint-tutorial
45+
$ make deploy
46+
```
47+
6848
-----
6949

7050
**Hackers and Slackers** tutorials are free of charge. If you found this tutorial helpful, a [small donation](https://www.buymeacoffee.com/hackersslackers) would be greatly appreciated to keep us in business. All proceeds go towards coffee, and all coffee goes towards more content.

0 commit comments

Comments
 (0)