• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python webnotes.init函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中webnotes.init函数的典型用法代码示例。如果您正苦于以下问题:Python init函数的具体用法?Python init怎么用?Python init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了init函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: mysql

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, '-h', webnotes.conf.db_host or "localhost", "-A"])
	webnotes.destroy()
开发者ID:Halfnhav,项目名称:wnframework,代码行数:7,代码来源:wnf.py


示例2: make_conf

def make_conf(db_name=None, db_password=None, site=None, site_config=None):
	try:
		from werkzeug.exceptions import NotFound
		import conf
		
		try:
			webnotes.init(site=site)
		except NotFound:
			pass
		
		if not site and webnotes.conf.site:
			site = webnotes.conf.site
			
		if site:
			# conf exists and site is specified, create site_config.json
			make_site_config(site, db_name, db_password, site_config)
		elif os.path.exists("conf.py"):
			print "conf.py exists"
		else:
			# pyc file exists but py doesn't
			raise ImportError
			
	except ImportError:
		if site:
			raise Exception("conf.py does not exist")
		else:
			# create conf.py
			with open(os.path.join("lib", "conf", "conf.py"), "r") as confsrc:
				with open("conf.py", "w") as conftar:
					conftar.write(confsrc.read() % get_conf_params(db_name, db_password))
	
	webnotes.destroy()
	webnotes.init(site=site)
开发者ID:ricardomomm,项目名称:wnframework,代码行数:33,代码来源:install.py


示例3: main

def main():
	parsed_args = webnotes._dict(vars(setup_parser()))
	fn = get_function(parsed_args)
	if not parsed_args.get("sites_path"):
		parsed_args["sites_path"] = "."
	
	if not parsed_args.get("make_app"):
			
		if parsed_args.get("site")=="all":
			for site in get_sites(parsed_args["sites_path"]):
				args = parsed_args.copy()
				args["site"] = site
				webnotes.init(site)
				run(fn, args)
		else:
			if not fn in site_arg_optional:
				if not parsed_args.get("site") and os.path.exists("currentsite.txt"):
					with open("currentsite.txt", "r") as sitefile:
						site = sitefile.read()
				else:
					site = parsed_args.get("site")

				if not site:
					print "Site argument required"
					exit(1)

				if fn != 'install' and not os.path.exists(site):
					print "Did not find folder '{}'. Are you in sites folder?".format(parsed_args.get("site"))
					exit(1)
					
				webnotes.init(site)
			run(fn, parsed_args)
	else:
		run(fn, parsed_args)
开发者ID:bindscha,项目名称:wnframework_old,代码行数:34,代码来源:cli.py


示例4: application

def application(request):
	webnotes.local.request = request
	
	try:
		site = _site or get_site_name(request.host)
		webnotes.init(site=site)
		
		if not webnotes.local.conf:
			# site does not exist
			raise NotFound
		
		webnotes.local.form_dict = webnotes._dict({ k:v[0] if isinstance(v, (list, tuple)) else v \
			for k, v in (request.form or request.args).iteritems() })
				
		webnotes.local._response = Response()
		webnotes.http_request = webnotes.auth.HTTPRequest()

		if webnotes.local.form_dict.cmd:
			webnotes.handler.handle()
		elif webnotes.request.path.startswith("/api/"):
			webnotes.api.handle()
		elif webnotes.local.request.method in ('GET', 'HEAD'):
			webnotes.webutils.render(webnotes.request.path[1:])
		else:
			raise NotFound

	except HTTPException, e:
		return e
开发者ID:bindscha,项目名称:wnframework_old,代码行数:28,代码来源:app.py


示例5: run_scheduler

def run_scheduler(site=None):
	from webnotes.utils.file_lock import create_lock, delete_lock
	import webnotes.utils.scheduler
	webnotes.init(site=site)
	if create_lock('scheduler'):
		webnotes.connect(site=site)
		print webnotes.utils.scheduler.execute()
		delete_lock('scheduler')
	webnotes.destroy()
开发者ID:Halfnhav,项目名称:wnframework,代码行数:9,代码来源:wnf.py


示例6: python

def python(site=None):
	import webnotes 
	import commands, os
	python = commands.getoutput('which python')
	webnotes.init(site=site)
	if site:
		os.environ["site"] = site
	os.environ["PYTHONSTARTUP"] = os.path.join(os.path.dirname(__file__), "pythonrc.py")
	os.execv(python, [python])
	webnotes.destroy()
开发者ID:Halfnhav,项目名称:wnframework,代码行数:10,代码来源:wnf.py


示例7: update_all_sites

def update_all_sites(remote=None, branch=None, verbose=True):
	pull(remote, branch)
	
	# maybe there are new framework changes, any consequences?
	reload(webnotes)
	
	build()
	for site in get_sites():
		webnotes.init(site)
		latest(verbose=verbose)
开发者ID:bindscha,项目名称:wnframework_old,代码行数:10,代码来源:cli.py


示例8: make_demo_app

def make_demo_app(site=None):
	webnotes.mute_emails = 1
	webnotes.init(site=site)

	utilities.demo.make_demo.make(reset=True, simulate=False)
	# setup demo user etc so that the site it up faster, while the data loads
	make_demo_user()
	make_demo_login_page()
	make_demo_on_login_script()
	utilities.demo.make_demo.make(reset=False, simulate=True)
开发者ID:mxmo-co,项目名称:erpnext,代码行数:10,代码来源:make_erpnext_demo.py


示例9: get_remote_and_branch

def get_remote_and_branch(remote=None, branch=None):
	if not (remote and branch):
		webnotes.init()
		if not webnotes.conf.branch:
			raise Exception("Please specify remote and branch")
			
		remote = remote or "origin"
		branch = branch or webnotes.conf.branch
		webnotes.destroy()
		
	return remote, branch
开发者ID:Halfnhav,项目名称:wnframework,代码行数:11,代码来源:wnf.py


示例10: update_site_config

def update_site_config(site_config, site, verbose=False):
	import json
	
	if isinstance(site_config, basestring):
		site_config = json.loads(site_config)
	
	webnotes.init(site=site)
	webnotes.conf.site_config.update(site_config)
	site_config_path = webnotes.get_conf_path(webnotes.conf.sites_dir, site)
	
	with open(site_config_path, "w") as f:
		json.dump(webnotes.conf.site_config, f, indent=1, sort_keys=True)
		
	webnotes.destroy()
开发者ID:Halfnhav,项目名称:wnframework,代码行数:14,代码来源:wnf.py


示例11: application

def application(request):
	webnotes.local.request = request
	
	try:
		site = webnotes.utils.get_site_name(request.host)
		webnotes.init(site=site)
		
		webnotes.local.form_dict = webnotes._dict({ k:v[0] if isinstance(v, (list, tuple)) else v \
			for k, v in (request.form or request.args).iteritems() })
				
		webnotes.local._response = Response()

		try:
			webnotes.http_request = webnotes.auth.HTTPRequest()
		except webnotes.AuthenticationError, e:
			pass
		
		if webnotes.form_dict.cmd:
			webnotes.handler.handle()
		else:
			webnotes.webutils.render(webnotes.request.path[1:])
开发者ID:hafeez3000,项目名称:wnframework,代码行数:21,代码来源:app.py


示例12: move

def move(site=None, dest_dir=None):
	import os
	if not dest_dir:
		raise Exception, "--dest_dir is required for --move"
	if not os.path.isdir(dest_dir):
		raise Exception, "destination is not a directory or does not exist"

	webnotes.init(site=site)
	old_path = webnotes.utils.get_site_path()
	new_path = os.path.join(dest_dir, site)

	# check if site dump of same name already exists
	site_dump_exists = True
	count = 0
	while site_dump_exists:
		final_new_path = new_path + (count and str(count) or "")
		site_dump_exists = os.path.exists(final_new_path)
		count = int(count or 0) + 1

	os.rename(old_path, final_new_path)
	webnotes.destroy()
	return os.path.basename(final_new_path)
开发者ID:Halfnhav,项目名称:wnframework,代码行数:22,代码来源:wnf.py


示例13: make_demo_fresh

def make_demo_fresh(site=None):
	import utilities.demo.make_demo
	webnotes.init(site=site)
	utilities.demo.make_demo.make(reset=True)
	webnotes.destroy()
开发者ID:Halfnhav,项目名称:wnframework,代码行数:5,代码来源:wnf.py


示例14: make_demo

def make_demo(site=None):
	import utilities.demo.make_demo
	webnotes.init(site=site)
	utilities.demo.make_demo.make()
	webnotes.destroy()
开发者ID:Halfnhav,项目名称:wnframework,代码行数:5,代码来源:wnf.py


示例15: install_fixtures

def install_fixtures(site=None):
	webnotes.init(site=site)
	from webnotes.install_lib.install import install_fixtures
	install_fixtures()
	webnotes.destroy()
开发者ID:Halfnhav,项目名称:wnframework,代码行数:5,代码来源:wnf.py


示例16: reinstall

def reinstall(site=None, verbose=True):
	webnotes.init(site=site)
	install(webnotes.conf.db_name, site=site, verbose=verbose, force=True)
开发者ID:Halfnhav,项目名称:wnframework,代码行数:3,代码来源:wnf.py



注:本文中的webnotes.init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python webnotes.model_wrapper函数代码示例发布时间:2022-05-26
下一篇:
Python webnotes.has_permission函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap