-
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.
- Loading branch information
antonio-piha
committed
Oct 8, 2019
0 parents
commit 851bf8d
Showing
265 changed files
with
55,854 additions
and
0 deletions.
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,125 @@ | ||
.vscode | ||
.sass* | ||
node_modules | ||
|
||
# pylint file | ||
googlecl-pylint.rc.txt | ||
assets/chromedriver | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
quickstart.py | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# 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/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# IPython Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# Mac files | ||
.DS_Store | ||
|
||
# Storage | ||
*.db | ||
logs/ | ||
|
||
# Editors | ||
.idea | ||
.vscode | ||
|
||
# pytest | ||
.pytest_cache/ | ||
tests/logs | ||
|
||
|
||
# Other | ||
*_backup | ||
*.bin | ||
proxy_auth* | ||
*.db-journal | ||
Installer/Windows/Output | ||
|
||
#keep | ||
!App/frontend-third-parties/ | ||
!App/frontend-third-parties/**/lib |
Empty file.
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 @@ | ||
__version__ = '2019.1' |
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,53 @@ | ||
# | ||
#===================================== | ||
# | ||
# THIS FILE IS THE APP STARTING POINT | ||
# | ||
#===================================== | ||
# | ||
# | ||
import sys | ||
|
||
# For InstaPy imports | ||
sys.path.append("..") | ||
|
||
from flask import Flask, flash, redirect | ||
from .create_app import create_app, ensure_app_dirs | ||
from .logger import Logger | ||
|
||
ensure_app_dirs() | ||
Logger.ensure_log_file_exists() | ||
|
||
# ========================================================= | ||
|
||
from . import frontend | ||
from .nav import nav | ||
from .database import init_database | ||
from .settings import Settings | ||
from . import templates_context | ||
from . import on_exit | ||
from . import service | ||
|
||
log = Logger.get(__name__) | ||
app = create_app(__name__) | ||
|
||
# APP initialisation | ||
try: | ||
init_database(app) | ||
templates_context.init_app(app) | ||
frontend.init_app(app) | ||
nav.init_app(app) | ||
service.init_app(app) | ||
except Exception as exc: | ||
log.error(exc, exc_info=True) | ||
|
||
# If everything else fails this will handle all Exceptions | ||
@app.errorhandler(Exception) | ||
def handle_exceptions(exc): | ||
flash('Unfortunately something bad happened and you got redirected to homepage. This error will be reported and fixed. Please try again what you were initially trying do to.', 'danger') | ||
log.warning(exc, exc_info=True) | ||
return redirect('/') | ||
|
||
log.info('App started.') | ||
|
||
|
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,34 @@ | ||
import os | ||
from flask import Flask, flash | ||
from .settings import assets_location_folder, Settings, InstaPySettings | ||
from .logger import Logger | ||
|
||
# Can't get logger instance here since it hasn't been initialised yet | ||
|
||
# APP creation | ||
def create_app(name=''): | ||
log = Logger.get(__name__) | ||
ensure_app_dirs() | ||
app = None | ||
try: | ||
app = Flask(name) | ||
Logger.init(app) | ||
app.config.from_object(Settings) | ||
except Exception as exc: | ||
app = None | ||
log.error(exc, exc_info=True) | ||
return app | ||
|
||
|
||
def ensure_app_dirs(): | ||
# Make sure all the folders exists | ||
# This should be covered with installation but it is good to double check | ||
directories = [ | ||
assets_location_folder, | ||
Settings.assets_location, | ||
InstaPySettings.assets_location | ||
] | ||
for directory in directories: | ||
if not os.path.exists(directory): | ||
os.makedirs(directory) | ||
|
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,3 @@ | ||
from .database import * | ||
from .model import * | ||
from .create_db import * |
Oops, something went wrong.