diff --git a/console.py b/console.py index b9e21bb..85618bb 100644 --- a/console.py +++ b/console.py @@ -3,7 +3,9 @@ import argparse import os import shutil +import getpass from pathlib import Path +from paramecio.modules.admin.models.admin import UserAdmin def start(): @@ -44,10 +46,53 @@ def start(): except: - print('Error: cannot copy the file. Check if exists and if you have permissions for this task') + print('Error: cannot copy the file config.py. Check if exists and if you have permissions for this task') + + try: + shutil.copy(workdir+'/frontend/index.py', args.path+'/index.py') + + except: + + print('Error: cannot copy the file index.py. Check if exists and if you have permissions for this task') + + try: + + shutil.copy(workdir+'/frontend/padmin.py', args.path+'/padmin.py') + + except: + + print('Error: cannot copy the file padmin.py. Check if exists and if you have permissions for this task') + # Question about mysql configuration? If yes, install configuration + s=input('Do you want use paramecio with MySQL database? y/n: ') + + if s=='y' or s=='Y': + + host_db=input('MySQL database server host, by default localhost: ').strip() + + user_db=input('MySQL database user, by default root: ').strip() + + pass_db=getpass.getpass('MySQL database password, by default "": ').strip() + + if host_db=='': + + host_db='localhost' + + if user_db=='': + + user_db='root' + + + connection="WebModel.connections={'default': {'name': 'default', 'host': '"+host_db+"', 'user': '"+user_db+"', 'password': '"+pass_db+"', 'db': 'example', 'charset': 'utf8mb4', 'set_connection': False} }" + + with open(path_settings+'/config.py', 'a') as f: + f.write("\n\n"+connection) + f.close() + + pass + # Question about install admin site. diff --git a/frontend/index.py b/frontend/index.py new file mode 100644 index 0000000..36beb5b --- /dev/null +++ b/frontend/index.py @@ -0,0 +1,8 @@ +#!/usr/bin/python3 + +from paramecio.index import create_app, run_app + +app=create_app() + +if __name__ == "__main__": + run_app(app) \ No newline at end of file diff --git a/frontend/padmin.py b/frontend/padmin.py new file mode 100644 index 0000000..a5c6e8c --- /dev/null +++ b/frontend/padmin.py @@ -0,0 +1,7 @@ +#!/usr/bin/python3 + +from paramecio.cromosoma.dbadmin import start + +start() + +