本文整理汇总了Python中uwsgi.reload函数的典型用法代码示例。如果您正苦于以下问题:Python reload函数的具体用法?Python reload怎么用?Python reload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reload函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: reload_uwsgi_on_code_change
def reload_uwsgi_on_code_change(sig):
"""This function will check every five seconds to see whether
the Django code has changed, and if it has uWSGI will reload.
This mimics the autoreload functionality
of manage.py runserver."""
if autoreload.code_changed():
uwsgi.reload()
开发者ID:thehackerati,项目名称:django-app-template,代码行数:7,代码来源:views.py
示例2: get
def get(self, request):
try:
import uwsgi
uwsgi.reload()
except ImportError:
pass # Probably the django started with runserver
return HttpResponseRedirect(reverse('rosetta-home'))
开发者ID:legios89,项目名称:BO-Webpage,代码行数:7,代码来源:views.py
示例3: update_uwsgi
def update_uwsgi(signum):
flatpages_root = app.config["FLATPAGES_ROOT"]
logger.debug("Udpating git repository at %s", flatpages_root)
hasToReload = update_repo(flatpages_root)
if hasToReload:
logger.debug("Reloading flatpages…")
uwsgi.reload()
开发者ID:gwTumm,项目名称:sipa,代码行数:7,代码来源:initialization.py
示例4: _update_settings
def _update_settings(self, values):
"""Modify the settings associated with the given dictionary."""
for name, value in values.iteritems():
if name in tmpl_context.settings:
setting = tmpl_context.settings[name]
else:
setting = Setting(key=name, value=value)
if value is None:
value = u''
else:
value = unicode(value)
if setting.value != value:
setting.value = value
DBSession.add(setting)
DBSession.flush()
# Clear the settings cache unless there are multiple processes.
# We have no way of notifying the other processes that they need
# to clear their caches too, so we've just gotta let it play out
# until all the caches expire.
if not request.environ.get('wsgi.multiprocess', False):
app_globals.settings_cache.clear()
else:
# uWSGI provides an automagically included module
# that we can use to call a graceful restart of all
# the uwsgi processes.
# http://projects.unbit.it/uwsgi/wiki/uWSGIReload
try:
import uwsgi
uwsgi.reload()
except ImportError:
pass
开发者ID:Jpoudrier,项目名称:mediacore-community,代码行数:32,代码来源:base.py
示例5: content_hook
def content_hook():
auth_key = current_app.config.get('GIT_UPDATE_HOOK_TOKEN')
if not auth_key:
# no key configured (default) → feature not enabled
abort(404)
key = request.args.get('token')
if not key:
logger.debug("`update-content` called without Token",
extra={'data': {'request_args': request.args}})
abort(401)
if key != auth_key:
logger.warning("`update-content` called with wrong Token",
extra={'data': {'request_args': request.args,
'auth_key': auth_key}})
abort(403)
logger.info("Update hook triggered. Fetching content.")
reload_necessary = update_repo(current_app.config['FLATPAGES_ROOT'])
if reload_necessary:
try:
import uwsgi
except ImportError:
logger.debug("UWSGI not present, skipping reload")
pass
else:
logger.debug("Reloading UWSGI...")
uwsgi.reload()
# 204: No content
# https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#204
return "", 204
开发者ID:BelphegorPrime,项目名称:sipa,代码行数:34,代码来源:hooks.py
示例6: reload
def reload(request):
if uwsgi.masterpid() > 0:
uwsgi.reload()
request.user.message_set.create(message="uWSGI reloaded")
else:
request.user.message_set.create(message="The uWSGI master process is not active")
return HttpResponseRedirect(reverse(index))
开发者ID:20tab,项目名称:uwsgi,代码行数:8,代码来源:views.py
示例7: reload_server
def reload_server():
try:
import uwsgi
uwsgi.reload()
except ImportError:
try:
path = inspect.getsourcefile(reload_server)
os.utime(path, None)
except Exception:
pass
开发者ID:spicycms,项目名称:spicy.core,代码行数:10,代码来源:dynamic_import.py
示例8: change_code_graceful_reload
def change_code_graceful_reload(sig):
"""
This method allows for the django runserver's autoreload
capability in uWSGI.
"""
if (getattr(settings, 'DEBUG', False)
and getattr(settings, 'UWSGI_AUTORELOAD', False)
and autoreload.code_changed()):
uwsgi.reload()
开发者ID:johnnadratowski,项目名称:jpylib,代码行数:10,代码来源:uwsgi_plugin.py
示例9: overwrite_data
def overwrite_data(request):
data = ''
if request.method == 'POST':
data = request.POST.get('text', '')
if data != '':
file = open('static/contractor_info.js', 'w')
file.write(data)
file.close
uwsgi.reload()
return HttpResponse('')
开发者ID:jpazdera,项目名称:FenceDirect-Contractor-Search,代码行数:10,代码来源:views.py
示例10: delete
def delete(self):
name = self.request.path_info.strip(' /')
# Delete document
docStore = get_userDocumentStore(self.session.user.username)
id_ = docStore.outIdNormalizer.process_string(session, name)
docStore.delete_document(session, id_)
self.response.status = "204 Deleted"
if uwsgi:
uwsgi.reload()
return ''
开发者ID:bloomonkey,项目名称:archiveshub,代码行数:10,代码来源:console.py
示例11: upgrade_app
def upgrade_app():
if request.method == 'POST':
file_ = next((file_ for file_ in request.files if api_app.is_valid_app_file(file_)), None)
if file_ is not None:
filename = secure_filename(file_)
request.files[file_].save(os.path.join(api_app.config['UPLOAD_FOLDER'], filename))
tmp_file = os.path.join('/tmp/', filename)
subprocess.call(['/usr/bin/unzip', '-o', tmp_file, '-d', '/usr/local/flask'])
uwsgi.reload()
return make_response('Updating app')
开发者ID:ArchiGithub,项目名称:zynq-sdk,代码行数:10,代码来源:api.py
示例12: update_uwsgi
def update_uwsgi(signum):
flatpages_root = app.config["FLATPAGES_ROOT"]
logger.debug("Udpating git repository at %s", flatpages_root)
hasToReload = update_repo(flatpages_root)
if hasToReload:
logger.debug("Reloading flatpages and uwsgi", extra={'data': {
'uwsgi.numproc': uwsgi.numproc,
'uwsgi.opt': uwsgi.opt,
'uwsgi.applications': uwsgi.applications,
}})
uwsgi.reload()
开发者ID:BelphegorPrime,项目名称:sipa,代码行数:11,代码来源:initialization.py
示例13: uwsgi_reload
def uwsgi_reload(request):
allowed_ips = getattr(settings, 'INTERNAL_IPS', ('127.0.0.1',),)
if request.META['REMOTE_ADDR'] in allowed_ips:
try:
import uwsgi
uwsgi.reload()
return HttpResponse('Reload OK')
except ImportError:
return HttpResponseServerError('Failed to import uwsgi')
return HttpResponseForbidden('Access denied. %s is not on the INTERNAL_IPS list.' % request.META['REMOTE_ADDR'])
开发者ID:revealit,项目名称:libreveal,代码行数:12,代码来源:views.py
示例14: reload_uwsgi
def reload_uwsgi():
if not have_uwsgi:
return "you aren't running web2py with uwsgi"
masterpid = uwsgi.masterpid()
if masterpid > 0:
form = FORM(INPUT(_type="submit", _value="Reload uWSGI"))
if form.process().accepted:
uwsgi.reload()
response.flash = "uWSGI reloaded correctly"
else:
form = ''
response.flash = "The uWSGI master process is not active"
return form
开发者ID:niphlod,项目名称:web2py_uwsgi_admin,代码行数:13,代码来源:uwsgi_admin.py
示例15: ws_options
def ws_options():
if request.method == 'GET':
options = Option.query.order_by(asc(func.lower(Option.key)))
data = {}
for o in options:
try:
if isinstance(bartendro_options[o.key], types.IntType):
value = int(o.value)
elif isinstance(bartendro_options[o.key], types.UnicodeType):
value = unicode(o.value)
elif isinstance(bartendro_options[o.key], types.FloatType):
value = float(o.value)
elif isinstance(bartendro_options[o.key], types.BooleanType):
value = boolean(o.value)
else:
raise InternalServerError
except KeyError:
pass
data[o.key] = value
return json.dumps({ 'options' : data });
if request.method == 'POST':
try:
data = request.json['options']
logout = request.json['logout']
except KeyError:
raise BadRequest
if logout: logout_user()
Option.query.delete()
for key in data:
option = Option(key, data[key])
db.session.add(option)
db.session.commit()
try:
import uwsgi
uwsgi.reload()
reload = True
except ImportError:
reload = False
app.options = load_options()
return json.dumps({ 'reload' : reload });
raise BadRequest
开发者ID:fivef,项目名称:bartendro,代码行数:50,代码来源:option.py
示例16: reload
def reload(request):
if uwsgi.masterpid() > 0:
uwsgi.reload()
messages.add_message(request,
messages.SUCCESS,
_('uWSGI reloaded'),
fail_silently=True)
else:
messages.add_message(request,
messages.ERROR,
_('The uWSGI master process is not active'),
fail_silently=True)
return HttpResponseRedirect(reverse(index))
开发者ID:edufelipe,项目名称:uwsgi_django,代码行数:14,代码来源:views.py
示例17: reload
def reload(request):
import uwsgi
if uwsgi.masterpid() > 0:
uwsgi.reload()
messages.add_message(request,
messages.SUCCESS,
_('uWSGI reloaded'),
fail_silently=True)
else:
messages.add_message(request,
messages.ERROR,
_('The uWSGI master process is not active'),
fail_silently=True)
return HttpResponseRedirect(reverse("admin:uwsgi_status_changelist"))
开发者ID:ionelmc,项目名称:django-uwsgi-admin,代码行数:15,代码来源:views.py
示例18: reload_wsgi
def reload_wsgi(request):
if 'mod_wsgi.process_group' in request.environ and \
request.environ.get('mod_wsgi.process_group', None) and \
'SCRIPT_FILENAME' in request.environ and \
int(request.environ.get('mod_wsgi.script_reloading', '0')):
try:
os.utime(request.environ.get('SCRIPT_FILENAME'), None)
except OSError:
pass
# Try auto-reloading via uwsgi daemon reload mechanism
try:
import uwsgi #@UnresolvedImport
# pretty easy right?
uwsgi.reload()
except:
# we may not be running under uwsgi :P
pass
开发者ID:palankai,项目名称:xadrpy,代码行数:17,代码来源:reload.py
示例19: auto_reload
def auto_reload(request):
if defaults.WSGI_AUTO_RELOAD is True:
env = request.environ.get
if env('mod_wsgi.process_group') and env('SCRIPT_FILENAME'):
if int(env('mod_wsgi.script_reloading', 0)):
try:
if os.path.exists(env('SCRIPT_FILENAME')):
os.utime(env('SCRIPT_FILENAME'), None)
except OSError:
pass
if defaults.UWSGI_AUTO_RELOAD is True:
try:
import uwsgi
uwsgi.reload()
except ImportError:
pass
开发者ID:ad-lebedev,项目名称:django-db-mailer,代码行数:18,代码来源:admin.py
示例20: check_for_modifications
def check_for_modifications(signum):
global file_mtimes
def iter_module_files():
for module in sys.modules.values():
filename = getattr(module, '__file__', None)
if filename:
old = None
while not os.path.isfile(filename):
old = filename
filename = os.path.dirname(filename)
if filename == old:
break
else:
if filename[-4:] in ('.pyc', '.pyo'):
filename = filename[:-1]
yield filename
def iter_assets():
base = os.path.dirname(os.path.dirname(__file__))
for root, dirnames, filenames in os.walk(base + 'static'):
for filename in filenames:
if filename.endswith('.js') or filename.endswith('.less'):
yield os.path.join(root, filename)
mtimes = file_mtimes
for filename in itertools.chain(iter_module_files(), iter_assets()):
try:
mtime = os.stat(filename).st_mtime
except OSError:
continue
old_time = mtimes.get(filename)
if old_time is None:
mtimes[filename] = mtime
continue
elif mtime > old_time:
uwsgi.reload()
return
开发者ID:abhijitr,项目名称:giza,代码行数:39,代码来源:__init__.py
注:本文中的uwsgi.reload函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论