Skip to content

Commit 0b5a705

Browse files
authored
Merge pull request #26 from vuLgAr/master
use pipenv and cleanup templates
2 parents 28af16a + e9307b5 commit 0b5a705

File tree

19 files changed

+409
-50
lines changed

19 files changed

+409
-50
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
APP_SETTINGS="project.server.config.DevelopmentConfig"
2+
FLASK_DEBUG=1

.gitignore

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
.env
2-
env
3-
venv
41
__pycache__
52

6-
*.pyc
7-
*.db
83
*.coverage
9-
.DS_Store
10-
env.sh
11-
migrations
4+
*.db
5+
*.pyc
6+
127
htmlcov
8+
migrations

.python-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ python:
77
- "2.7"
88

99
install:
10-
- pip install -r requirements.txt
11-
- pip install coveralls
10+
- "pip install pipenv"
11+
- "pipenv install --dev"
1212

1313
script:
1414
- python manage.py cov

Pipfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[[source]]
2+
3+
url = "https://pypi.python.org/simple"
4+
verify_ssl = true
5+
name = "pypi"
6+
7+
8+
[packages]
9+
10+
flask = "*"
11+
flask-bcrypt = "*"
12+
flask-bootstrap = "*"
13+
flask-login = "*"
14+
flask-migrate = "*"
15+
flask-sqlalchemy = "*"
16+
flask-wtf = "*"
17+
18+
19+
[dev-packages]
20+
21+
coverage = "*"
22+
flask-debugtoolbar = "*"
23+
flask-testing = "*"
24+
25+
26+
[requires]
27+
28+
python_version = "3.6.4"

Pipfile.lock

Lines changed: 342 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,26 @@ Flask starter project...
1111
1. Create and activate a virtualenv
1212
1. Install the requirements
1313

14-
### Set Environment Variables
1514

16-
Update *project/server/config.py*, and then run:
15+
### Configuring
16+
17+
Inspect and update `project/server/config.py`.
18+
19+
20+
### Setting Environment Variables
21+
22+
Eg: for using the development config with debug mode enabled
1723

1824
```sh
1925
$ export APP_SETTINGS="project.server.config.DevelopmentConfig"
26+
$ export FLASK_DEBUG=1
2027
```
2128

22-
or
29+
Alternatively using pipenv or python-dotenv you can define your application configuration in the `.env` file.
2330

2431
```sh
25-
$ export APP_SETTINGS="project.server.config.ProductionConfig"
32+
APP_SETTINGS="project.server.config.DevelopmentConfig"
33+
FLASK_DEBUG=1
2634
```
2735

2836
### Create DB
@@ -37,16 +45,9 @@ $ python manage.py create_data
3745

3846
### Run the Application
3947

40-
With debug mode:
41-
42-
```sh
43-
$ export FLASK_DEBUG=1 && python manage.py run
44-
```
45-
46-
Without debug mode:
4748

4849
```sh
49-
$ export FLASK_DEBUG=0 && python manage.py run
50+
$ python manage.py run
5051
```
5152

5253
Access the application at the address [http://localhost:5000/](http://localhost:5000/)

project/client/templates/_base.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@
3030
{% for category, message in messages %}
3131
<div class="alert alert-{{ category }}">
3232
<a class="close" title="Close" href="#" data-dismiss="alert">&times;</a>
33-
{{message}}
33+
{{message}}
3434
</div>
3535
{% endfor %}
3636
</div>
3737
</div>
3838
{% endif %}
3939
{% endwith %}
4040

41-
4241
<!-- child template -->
4342
{% block content %}{% endblock %}
4443

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{% extends "_base.html" %}
2-
32
{% block page_title %}- Unauthorized{% endblock %}
4-
53
{% block content %}
4+
65
<div class="jumbotron">
76
<div class="text-center">
87
<h1>401</h1>
98
<p>You are not authorized to view this page. Please <a href="{{ url_for('user.login')}}">log in</a>.</p>
109
</div>
1110
</div>
11+
1212
{% endblock %}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{% extends "_base.html" %}
2-
3-
{% block page_title %}- Unauthorized{% endblock %}
4-
2+
{% block page_title %}- Forbidden{% endblock %}
53
{% block content %}
4+
65
<div class="jumbotron">
76
<div class="text-center">
8-
<h1>401</h1>
9-
<p>You are not authorized to view this page. Please <a href="{{ url_for('user.login')}}">log in</a>.</p>
7+
<h1>403</h1>
8+
<p>You are forbidden from viewing this page. Please <a href="{{ url_for('user.login')}}">log in</a>.</p>
109
</div>
1110
</div>
11+
1212
{% endblock %}

0 commit comments

Comments
 (0)