Skip to content

Commit a4698bb

Browse files
author
maypatha
committed
Updates, README.md
1 parent 1656428 commit a4698bb

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,69 @@
11
Flask-REST-Server-Template
22
==========================
33

4+
[![Build Status](https://travis-ci.com/onlinejudge95/Flask-REST-Server-Template.svg?branch=master)](https://travis-ci.com/onlinejudge95/Flask-REST-Server-Template)
5+
![GitHub top language](https://img.shields.io/github/languages/top/onlinejudge95/Flask-REST-Server-Template.svg)
6+
[![codecov](https://codecov.io/gh/onlinejudge95/Flask-REST-Server-Template/branch/master/graph/badge.svg)](https://codecov.io/gh/onlinejudge95/Flask-REST-Server-Template)
7+
[![Updates](https://pyup.io/repos/github/onlinejudge95/Flask-REST-Server-Template/shield.svg)](https://pyup.io/repos/github/onlinejudge95/Flask-REST-Server-Template/)
8+
[![Python 3](https://pyup.io/repos/github/onlinejudge95/Flask-REST-Server-Template/python-3-shield.svg)](https://pyup.io/repos/github/onlinejudge95/Flask-REST-Server-Template/)
9+
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/onlinejudge95/Github-Bot-Service.svg)
10+
![GitHub issues](https://img.shields.io/github/issues/onlinejudge95/Flask-REST-Server-Template.svg)
11+
![GitHub pull requests](https://img.shields.io/github/issues-pr/onlinejudge95/Flask-REST-Server-Template.svg)
12+
![GitHub](https://img.shields.io/github/license/onlinejudge95/Flask-REST-Server-Template.svg)
13+
![GitHub last commit](https://img.shields.io/github/last-commit/onlinejudge95/Flask-REST-Server-Template.svg)
14+
415
## Info
16+
This is a template for spinning up a REST server in Flask for API first development.
17+
Use this repo as a template repo.
518

619
## Dependencies
20+
The server is tested in our travis account for following versions of Python
21+
* 3.6
22+
* 3.7
23+
* 3.7-dev
24+
* 3.8-dev
25+
26+
The server dependencies are specified based according to the environment.
27+
* Production level dependencies are defined in `requirements/prod.txt`.
28+
* Development level dependencies are defined in `requirements/dev.txt`.
29+
* Testing level dependencies are defined in `requirements/test.txt`.
30+
31+
## Docker
32+
The image is pushed to dockerhub {$LINK}, every push to git repository triggers a new build at the dockerhub.
33+
34+
* To build the image after modifications, run
35+
```
36+
$ docker build -t {$IMAGE}:{$TAG} .
37+
```
38+
* To run the container after the image has build successfully, run
39+
```
40+
$ docker run -it -d -p {$EXTERNAL_PORT}:8000 {$IMAGE}:{$TAG}
41+
```
742

843
## Setup
44+
To setup the dev env use the following commands.
45+
```
46+
$ python3 -m venv env
47+
$ source env/bin/activate
48+
(env) $ pip install --cache-dir .pip.cache/ --progress-bar emoji --upgrade pip setuptools
49+
(env) $ pip install --cache-dir .pip.cache/ --progress-bar emoji --requirement requirements/dev.txt
50+
(env) $ cp .env.example .env
51+
```
52+
To setup the db use the following commands.
53+
```
54+
(env) $ mysql -u user -p
55+
mysql > CREATE DATABASE $DB;
56+
mysql > CREATE USER '$USER'@'$HOST' IDENTIFIED BY $PASSWORD;
57+
mysql > GRANT ALL PRIVILEGES ON * . * TO '$USER'@'$HOST';
58+
mysql > FLUSH PRIVILEGES;
59+
mysql > exit;
60+
(env) $ python manage.py db init
61+
```
62+
To make a migration run the folowing commands
63+
```
64+
(env) $ python manage.py db migrate -m $MESSAGE
65+
(env) $ python manage.py db upgrade
66+
```
967

1068
## Contact
1169
[onlinejudge95](mailto:onlinejudge95@gmail.com)

0 commit comments

Comments
 (0)