Added frontend and console
This commit is contained in:
parent
b5790e35f7
commit
642371ccef
3 changed files with 61 additions and 1 deletions
47
console.py
47
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.
|
||||
|
||||
|
||||
|
|
|
|||
8
frontend/index.py
Normal file
8
frontend/index.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from paramecio.index import create_app, run_app
|
||||
|
||||
app=create_app()
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_app(app)
|
||||
7
frontend/padmin.py
Normal file
7
frontend/padmin.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from paramecio.cromosoma.dbadmin import start
|
||||
|
||||
start()
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue