Fixes in console.py for create new paramecio2 site

This commit is contained in:
absurdo 2023-09-15 23:38:42 +02:00
parent bc05d7725e
commit deeec158d6

View file

@ -8,7 +8,7 @@ import re
from pathlib import Path
from base64 import b64encode
from paramecio2.libraries.db.webmodel import WebModel
from paramecio2.modules.admin.models.admin import UserAdmin
from paramecio2.modules.admin.models.admin import UserAdmin, LoginTries
from subprocess import call
from urllib.parse import urlparse
@ -80,49 +80,7 @@ def start():
print('Error: cannot copy the file index.py to app.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')
try:
shutil.copy(workdir+'/frontend/i18nadmin.py', args.path+'/i18nadmin.py')
except:
print('Error: cannot copy the file i18nadmin.py. Check if exists and if you have permissions for this task')
try:
shutil.copy(workdir+'/frontend/regenerate.py', args.path+'/regenerate.py')
except:
print('Error: cannot copy the file regenerate.py. Check if exists and if you have permissions for this task')
try:
shutil.copy(workdir+'/frontend/create_module.py', args.path+'/create_module.py')
except:
print('Error: cannot copy the file create_module.py. Check if exists and if you have permissions for this task')
try:
shutil.copy(workdir+'/settings/modules.py', path_settings+'/modules.py')
except:
print('Error: cannot copy the file modules.py. Check if exists and if you have permissions for this task')
"""
if args.symlink==True:
try:
os.symlink(workdir, args.path+'/paramecio2', True)
@ -182,6 +140,8 @@ def start():
e_q=input('Email for site: ')
conf=conf.replace("no-reply@example.com", e_q)
#if e_q=='':
@ -232,6 +192,7 @@ def start():
conn=WebModel.connection()
useradmin=UserAdmin(conn)
logintries=LoginTries(conn)
# Check if db exists
@ -268,6 +229,9 @@ def start():
print('Error: cannot create table admin, you can create this table with padmin.py')
else:
sql_login=logintries.create_table()
logintries.query(sql_login)
# Add admin module to config
with open(path_settings+'/config.py', 'r') as f: