From b5790e35f76f55925c7f3d25da6fc7444d94ebf3 Mon Sep 17 00:00:00 2001 From: Antonio de la Rosa Date: Wed, 9 Dec 2015 04:05:29 +0100 Subject: [PATCH] Added console.py file --- REQUIREMENTS | 3 +-- console.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++ tests/formtest.py | 5 +++++ 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 console.py create mode 100644 tests/formtest.py diff --git a/REQUIREMENTS b/REQUIREMENTS index 57fd9a2..b997b53 100644 --- a/REQUIREMENTS +++ b/REQUIREMENTS @@ -2,9 +2,8 @@ - Python >3.3 - Bottle 0.12+ -- Jinja2 +- Mako - passlib -- cffi - bcrypt Use PIP is recommended for new installations. diff --git a/console.py b/console.py new file mode 100644 index 0000000..b9e21bb --- /dev/null +++ b/console.py @@ -0,0 +1,55 @@ +#!/usr/bin/python3 + +import argparse +import os +import shutil +from pathlib import Path + +def start(): + + parser=argparse.ArgumentParser(description='A tool for create new paramecio sites') + + parser.add_argument('--path', help='The path where the paramecio site is created', required=True) + + args=parser.parse_args() + + workdir=os.path.dirname(os.path.abspath(__file__)) + + # Create directory + + path=Path(args.path) + + try: + path.mkdir(0o755, True) + + except: + + print('Error: cannot create the directory. Check if exists and if you have permissions') + + # Create folder settings and copy index.py, admin.py + + path_settings=args.path+'/settings' + + try: + + os.mkdir(path_settings, 0o755) + except: + print('Error: cannot create the directory. Check if exists and if you have permissions') + + # Copy the files + + try: + + shutil.copy(workdir+'/settings/config.py.sample', path_settings+'/config.py') + + except: + + print('Error: cannot copy the file. Check if exists and if you have permissions for this task') + + # Question about mysql configuration? If yes, install configuration + + # Question about install admin site. + + +if __name__=="__main__": + start() \ No newline at end of file diff --git a/tests/formtest.py b/tests/formtest.py new file mode 100644 index 0000000..3d3521d --- /dev/null +++ b/tests/formtest.py @@ -0,0 +1,5 @@ +from settings import config +from paramecio.cromosoma.webmodel import WebModel +from paramecio.cromosoma import corefields +import unittest +