add mysql and runserver utilites
This commit is contained in:
parent
65d03ceaf3
commit
cf23b335ca
2 changed files with 27 additions and 7 deletions
|
|
@ -57,14 +57,18 @@ application = StaticDataMiddleware(application, {
|
|||
'/': 'public',
|
||||
})
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
def serve(port=8000):
|
||||
from werkzeug.serving import run_simple
|
||||
|
||||
port = 8000
|
||||
if len(sys.argv) > 1:
|
||||
port = sys.argv[1]
|
||||
|
||||
run_simple('0.0.0.0', int(port), application, use_reloader=True,
|
||||
use_debugger=True, use_evalex=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
|
||||
port = None
|
||||
if len(sys.argv) > 1:
|
||||
port = sys.argv[1]
|
||||
|
||||
serve(port)
|
||||
|
||||
|
||||
|
|
|
|||
16
wnf.py
16
wnf.py
|
|
@ -131,6 +131,9 @@ def setup_utilities(parser):
|
|||
help="Create new conf.py file")
|
||||
parser.add_argument("--set_admin_password", metavar='ADMIN-PASSWORD', nargs=1,
|
||||
help="Set administrator password")
|
||||
parser.add_argument("--mysql", action="store_true", help="get mysql shell for a site")
|
||||
parser.add_argument("--serve", action="store_true", help="Run development server")
|
||||
parser.add_argument("--port", default=8000, type=int, help="port for development server")
|
||||
|
||||
# clear
|
||||
parser.add_argument("--clear_web", default=False, action="store_true",
|
||||
|
|
@ -519,6 +522,19 @@ def set_admin_password(admin_password, site=None):
|
|||
webnotes.conn.commit()
|
||||
webnotes.destroy()
|
||||
|
||||
@cmd
|
||||
def mysql(site=None):
|
||||
import webnotes
|
||||
import commands, os
|
||||
msq = commands.getoutput('which mysql')
|
||||
webnotes.init(site=site)
|
||||
os.execv(msq, [msq, '-u', webnotes.conf.db_name, '-p'+webnotes.conf.db_password, webnotes.conf.db_name])
|
||||
|
||||
@cmd
|
||||
def serve(port=8000):
|
||||
import webnotes.app
|
||||
webnotes.app.serve(port=port)
|
||||
|
||||
def replace_code(start, txt1, txt2, extn, search=None, force=False):
|
||||
"""replace all txt1 by txt2 in files with extension (extn)"""
|
||||
import webnotes.utils
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue