From f7b81c0c3bfe6b1f51b6e18528a665a1c36f9d60 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sun, 26 Apr 2020 13:55:18 +0200 Subject: [PATCH] New way to run pynyaata --- README.md | 2 +- pynyaata/__init__.py | 6 +++++- run.py | 6 ++++-- setup.py | 3 +++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cc59810..5b85e66 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ After a good rewrite in Python, it's time to show it to the public, and here it - Clone this repository - Launch a terminal and move into the root of the cloned repository - Run `pip install -r requirements.txt` -- Run `python3 run.py` +- Run `python3 run.py` or simply `pynyaata` - The app is accessible at http://localhost:5000 ## Features diff --git a/pynyaata/__init__.py b/pynyaata/__init__.py index 613af16..70e1ce2 100644 --- a/pynyaata/__init__.py +++ b/pynyaata/__init__.py @@ -3,7 +3,7 @@ from operator import attrgetter, itemgetter from flask import redirect, render_template, request, url_for, abort -from .config import app, auth, ADMIN_USERNAME, ADMIN_PASSWORD, MYSQL_ENABLED +from .config import app, auth, ADMIN_USERNAME, ADMIN_PASSWORD, MYSQL_ENABLED, APP_PORT, IS_DEBUG from .connectors import * from .connectors.core import ConnectorCore, ConnectorLang, ConnectorReturn from .forms import SearchForm, DeleteForm, EditForm @@ -175,3 +175,7 @@ def admin_edit(link_id=None): link.vf = False return render_template('admin/edit.html', search_form=SearchForm(), link=link, folders=folders, action_form=form) + + +def run(): + app.run('0.0.0.0', APP_PORT, IS_DEBUG) diff --git a/run.py b/run.py index 6fe02fc..a0c3d29 100644 --- a/run.py +++ b/run.py @@ -1,3 +1,5 @@ -from pynyaata.config import app, APP_PORT, IS_DEBUG +#!/usr/bin/env python3 +from pynyaata import run -app.run('0.0.0.0', APP_PORT, IS_DEBUG) +if __name__ == "__main__": + run() diff --git a/setup.py b/setup.py index f4d9885..f810823 100644 --- a/setup.py +++ b/setup.py @@ -20,6 +20,9 @@ setup( packages=find_packages(), install_requires=requirements, include_package_data=True, + entry_points={ + 'console_scripts': ['pynyaata=pynyaata:run'], + }, classifiers=[ "Programming Language :: Python :: 3", "Operating System :: OS Independent",