我正在尝试从其自己的一个视图向我的Flask应用程序发送一个帖子请求,但它会挂起,直到我杀死服务器.如果我在JavaScript中执行请求,它可以正常工作.为什么不能使用Python代码?
from flask import Blueprint, render_template, abort, request, Response, session, url_for
from jinja2 import TemplateNotFound
from flask.ext.wtf import Form
from wtforms import BooleanField, TextField, PasswordField
import requests
login = Blueprint('login', __name__, template_folder='templates')
class LoginForm(Form):
email = TextField('Email')
password = PasswordField('Password')
@login.route('/login', methods=['GET', 'POST'])
def _login():
form = LoginForm(request.form, csrf_enabled=False)
if form.validate_on_submit():
return requests.post(request.url_root + '/api/login', data={"test": True})
return render_template('login.html', form=form)
Run Code Online (Sandbox Code Playgroud) 所以我试图在脚本中稍微自动化 certbot 。当我运行这个时sudo certbot --nginx -d your_domain -d www.your_domain
我得到以下信息:
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] …Run Code Online (Sandbox Code Playgroud) 所以我从 Flask 提供一个 index.html 文件。index.html 文件来自使用以下命令构建的项目:https ://github.com/facebookincubator/create-react-app
我在 React 应用程序中设置了几个路由,例如:“/users”和“/contracts”
当我刷新其中一条路线时,我从 Flask 收到 404,但是当“单击”网站上找到的链接时,它们工作得很好。
为什么我的屏幕只是黑色?
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <stdio.h>
#include <stdlib.h>
//#include "include/state.h"
//#include "include/state_machine.h"
//#include "include/renderable.h"
const int WIDTH = 800;
const int HEIGHT = 600;
// called when user resizes window
void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
glViewport(0, 0, width, height);
}
// called when we receive input
void processInput(GLFWwindow *window) {
if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, 1);
}
GLuint get_checker_texture() {
unsigned char texDat[64];
for (int i = 0; i < 64; ++i)
texDat[i] = ((i + …Run Code Online (Sandbox Code Playgroud) 为什么以下程序不打印s字符?:
#include <stdlib.h>
#include <stdio.h>
int main(void) {
unsigned char s = '\0';
unsigned int bits[8] = {0, 1, 1, 1, 0, 0, 1, 1};
for (int i = 0; i < 8; i++) {
s ^= bits[i] << i;
}
printf("%c\n", s);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
所以我基本上试图s从位列表中创建字符.为什么我从这个程序中得到一些其他奇怪的角色?
所以我想在ViM启动时运行以下命令:
ctags -R .
Run Code Online (Sandbox Code Playgroud)
这可能吗?我希望能有一些东西能~/.vimrc做到这一点.
谢谢!