我正在php中实现一个登录系统并使用ajax请求.
这是我的要求
hr.open("POST", url, true);
hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
hr.onreadystatechange = function() {
var return_data = hr.responseText;
if(hr.readyState == 4 && hr.status == 200) {
alert('is logged');
}else if (hr.status == 400){
alert('is not logged');
}
}
hr.send(vars); // Actually execute the request
Run Code Online (Sandbox Code Playgroud)
但当我收到回复时,浏览器会发出各种警报.任何人都可以帮忙解决这个问题吗?
刚刚将我的Mac更新为El Capitan 10.11.我试图用Celery 3.1运行Django 1.6,我现在收到此错误:
Unhandled exception in thread started by <function wrapper at 0x10f861050>
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 93, in wrapper
fn(*args, **kwargs)
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 101, in inner_run
self.validate(display_num_errors=True)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 75, in _populate
self.load_app(app_name, True)
File "/Library/Python/2.7/site-packages/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' …Run Code Online (Sandbox Code Playgroud) 我试图用两个数据库(1个主数据库,1个读取副本)运行我的Django应用程序.我的问题是如果我在写入代码爆炸后立即尝试阅读.例如:
要么
代码运行速度比读取副本快.如果读取操作使用副本,则代码崩溃,因为它没有及时更新.
有什么方法可以避免这种情况吗?例如,要读取的数据库是通过请求而不是按操作选择的?
我的路由器与Django的文档完全相同:
import random
class PrimaryReplicaRouter(object):
def db_for_read(self, model, **hints):
"""
Reads go to a randomly-chosen replica.
"""
return random.choice(['replica1', 'replica2'])
def db_for_write(self, model, **hints):
"""
Writes always go to primary.
"""
return 'primary'
def allow_relation(self, obj1, obj2, **hints):
"""
Relations between objects are allowed if both objects are
in the primary/replica pool.
"""
db_list = ('primary', 'replica1', 'replica2')
if obj1._state.db in db_list and obj2._state.db in db_list:
return True
return …Run Code Online (Sandbox Code Playgroud) 我正在尝试将文件上传到亚马逊的虚拟机.我有一些问题.
我想我必须给我的服务器文件夹授予(777)权限才能上传我的文件.如果我不这样做就行不通.这个可以吗?
提供这些权限是否安全?