diff --git a/README.rst b/README.rst index 55b8292..d74ee39 100644 --- a/README.rst +++ b/README.rst @@ -75,7 +75,7 @@ Quick Start First step is to create a mandaye project:: - $ mandaye --newproject PROJECT_NAME + $ mandaye-admin --newproject PROJECT_NAME $ cd PROJECT_NAME Configure your project (look configuration section):: @@ -92,7 +92,7 @@ Launch mandaye server:: $ PROJECT_NAME_server -mandaye_server.py use gunicorn and gunicorn options (please read http://gunicorn.org/configure.html) +PROJECT_NAME_server uses gunicorn and gunicorn options (please read http://gunicorn.org/configure.html) You could also use gunicorn.conf.py-sample (in the mandaye files):: diff --git a/requirements.txt b/requirements.txt index 560d2ba..552acaa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,6 @@ pycrypto>=2.0 lxml>=2.0 xtraceback>=0.3 sqlalchemy>=0.7,<0.8 -alembic >= 0.5.0 +alembic>=0.5.0 Mako>=0.4 static diff --git a/scripts/mandaye b/scripts/mandaye-admin similarity index 100% rename from scripts/mandaye rename to scripts/mandaye-admin diff --git a/scripts/mandaye_manager_sql.py b/scripts/mandaye_manager_sql.py deleted file mode 100755 index 3931544..0000000 --- a/scripts/mandaye_manager_sql.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" Script to administrate mandaye server -""" - -import base64 - -from optparse import OptionParser - -from mandaye import config -from mandaye.log import logger - -def get_cmd_options(): - usage = "usage: %prog --newproject|--createdb|--cryptpwd" - parser = OptionParser(usage=usage) - parser.add_option("--createdb", - dest="createdb", - default=False, - action="store_true", - help="Create the Mandaye database" - ) - parser.add_option("--cryptpwd", - dest="cryptpwd", - default=False, - action="store_true", - help="Crypt external password in Mandaye's database" - ) - parser.add_option("--newproject", - dest="cryptpwd", - default=False, - action="store_true", - help="Crypt external password in Mandaye's database" - ) - (options, args) = parser.parse_args() - return options - -def encrypt_pwd(pwd): - from Crypto.Cipher import AES - logger.debug("Encrypt password") - enc_pwd = pwd - if config.encrypt_secret: - try: - cipher = AES.new(config.encrypt_secret, AES.MODE_CFB) - enc_pwd = cipher.encrypt(pwd) - enc_pwd = base64.b64encode(enc_pwd) - except Exception, e: - if config.debug: - traceback.print_exc() - logger.warning('Password encrypting failed %s' % e) - else: - logger.warning("You must set a secret to use pwd encryption") - return enc_pwd - -def main(): - options = get_cmd_options() - if options.createdb: - logger.info("Creating database...") - if config.db_url: - from alembic.config import Config - from alembic import command - alembic_cfg = Config("alembic.ini") - command.upgrade(alembic_cfg, "head") - logger.info("Database created") - if options.cryptpwd: - from mandaye.config.backend import ManagerSPUser - for user in ManagerSPUser.all(): - user.password = encrypt_pwd(user.password) - ManagerSPUser.save() - -if __name__ == "__main__": - main() - diff --git a/scripts/server.py b/scripts/server.py deleted file mode 100755 index 1402a67..0000000 --- a/scripts/server.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" Script to launch mandaye with gunicorn server -""" - -import sys -import os - -from mandaye.log import logger -from gunicorn.app.wsgiapp import WSGIApplication - -class WSGIApplication(WSGIApplication): - - def init(self, parser, opts, args): - self.cfg.set("default_proc_name", "mandaye.wsgi:application") - self.app_uri = "mandaye.wsgi:application" - - sys.path.insert(0, os.getcwd()) - -def main(): - """ The ``gunicorn`` command line runner for launcing Gunicorn with - generic WSGI applications. - """ - logger.info('Mandaye start') - WSGIApplication("%prog [OPTIONS]").run() - -if __name__ == "__main__": - main() diff --git a/setup.py b/setup.py index 810e42d..5082bcb 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ setup(name="mandaye", author_email="info@entrouvert.org", maintainer="Jerome Schneider", maintainer_email="jschneider@entrouvert.com", - scripts=['scripts/mandaye'], + scripts=['scripts/mandaye-admin'], include_package_data = True, packages=find_packages(), install_requires=install_requires