-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from andrew4ever/dev
Pre-release
- Loading branch information
Showing
18 changed files
with
779 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# THESE CREDENTIALS ARE FOR OLD DATABASE THAT WILL BE DEPRECATED SOON | ||
DATABASE_HOST= | ||
DATABASE= | ||
USERNAME= | ||
PASSWORD= | ||
|
||
SESSION_COOKIE_NAME= | ||
|
||
# NEW DATABASE URI | ||
SQLALCHEMY_DATABASE_URI='mysql+mysqlconnector://user:pass@host/database' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,243 @@ | ||
|
||
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,python,flask,venv,git | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,python,flask,venv,git | ||
|
||
### Flask ### | ||
instance/* | ||
!instance/.gitignore | ||
.webassets-cache | ||
|
||
### Flask.Python Stack ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
pytestdebug.log | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
doc/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
### Git ### | ||
# Created by git for backups. To disable backups in Git: | ||
# $ git config --global mergetool.keepBackup false | ||
*.orig | ||
|
||
# Created by git when using merge tools for conflicts | ||
*.BACKUP.* | ||
*.BASE.* | ||
*.LOCAL.* | ||
*.REMOTE.* | ||
*_BACKUP_*.txt | ||
*_BASE_*.txt | ||
*_LOCAL_*.txt | ||
*_REMOTE_*.txt | ||
|
||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
|
||
# C extensions | ||
|
||
# Distribution / packaging | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
|
||
# Installer logs | ||
|
||
# Unit test / coverage reports | ||
|
||
# Translations | ||
|
||
# Django stuff: | ||
|
||
# Flask stuff: | ||
|
||
# Scrapy stuff: | ||
|
||
# Sphinx documentation | ||
|
||
# PyBuilder | ||
|
||
# Jupyter Notebook | ||
|
||
# IPython | ||
|
||
# pyenv | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
|
||
# Celery stuff | ||
|
||
# SageMath parsed files | ||
|
||
# Environments | ||
|
||
# Spyder project settings | ||
|
||
# Rope project settings | ||
|
||
# mkdocs documentation | ||
|
||
# mypy | ||
|
||
# Pyre type checker | ||
|
||
# pytype static type analyzer | ||
|
||
### venv ### | ||
# Virtualenv | ||
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/ | ||
[Bb]in | ||
[Ii]nclude | ||
[Ll]ib | ||
[Ll]ib64 | ||
[Ll]ocal | ||
[Ss]cripts | ||
pyvenv.cfg | ||
pip-selfcheck.json | ||
|
||
### VisualStudioCode ### | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
*.code-workspace | ||
|
||
### VisualStudioCode Patch ### | ||
# Ignore all local history of files | ||
.history | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,python,flask,venv,git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"python.linting.pylintArgs": [ | ||
"--init-hook", | ||
"import sys; sys.path.insert(0, './common', './resources')" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,18 @@ | ||
# ecobrobotsbackend | ||
# #brobots eco-project backend | ||
|
||
This is a new Python back-end for #brobots eco-project. Previous version was written in PHP and had major flaws. | ||
|
||
**#brobots eco-project** is a net of sensors that collect data about air quality in Brovary. | ||
|
||
## Note | ||
|
||
Currently the project depends on older back-end as it's receiving data from sensors. In future new version will fully replace older back-end. | ||
|
||
## What's used | ||
|
||
Server is based on **Flask** and few extensions: | ||
|
||
- Flask RESTful | ||
- Flask SQLAlchemy | ||
|
||
Database: **MySQL** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from flask import Flask | ||
from flask_restful import Api | ||
from flask_sqlalchemy import SQLAlchemy | ||
|
||
from config import DevConfig as Config | ||
|
||
|
||
db = SQLAlchemy() | ||
|
||
|
||
def create_app(): | ||
from resources.area import AreaResource | ||
from resources.map import Map | ||
|
||
app = Flask(__name__) | ||
app.config.from_object(Config()) | ||
|
||
api = Api(app) | ||
api.add_resource(AreaResource, '/area') | ||
api.add_resource(Map, '/map') | ||
|
||
db.init_app(app) | ||
|
||
with app.app_context(): | ||
from models import AreaModel | ||
db.create_all() | ||
|
||
return app |
Oops, something went wrong.