cleanning: removing now useless scripts like mandaye_manager_sql.py
This commit is contained in:
parent
1f0b7c6002
commit
fc40e9b5a3
|
@ -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)::
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
@ -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()
|
2
setup.py
2
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
|
||||
|
|
Reference in New Issue