小编Seb*_*son的帖子

向自己发送帖子请求时,Flask会挂起

我正在尝试从其自己的一个视图向我的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)

python flask

12
推荐指数
1
解决办法
5275
查看次数

Certbot,指定重定向而不回答问题

所以我试图在脚本中稍微自动化 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)

nginx certbot

5
推荐指数
1
解决办法
3677
查看次数

Flask,为 React 应用程序提供服务:无法刷新“页面”

所以我从 Flask 提供一个 index.html 文件。index.html 文件来自使用以下命令构建的项目:https ://github.com/facebookincubator/create-react-app

我在 React 应用程序中设置了几个路由,例如:“/users”和“/contracts”

当我刷新其中一条路线时,我从 Flask 收到 404,但是当“单击”网站上找到的链接时,它们工作得很好。

python flask reactjs

4
推荐指数
1
解决办法
1779
查看次数

为什么我的OpenGL代码不呈现方格纹理

为什么我的屏幕只是黑色?

#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)

c opengl glfw

1
推荐指数
1
解决办法
144
查看次数

为什么位01110011的字节不能成为字符`s`?

为什么以下程序不打印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从位列表中创建字符.为什么我从这个程序中得到一些其他奇怪的角色?

c byte ascii bit

1
推荐指数
1
解决办法
60
查看次数

每当启动ViM时运行bash命令

所以我想在ViM启动时运行以下命令:

ctags -R .
Run Code Online (Sandbox Code Playgroud)

这可能吗?我希望能有一些东西能~/.vimrc做到这一点.

谢谢!

vim ctags

1
推荐指数
1
解决办法
40
查看次数

标签 统计

c ×2

flask ×2

python ×2

ascii ×1

bit ×1

byte ×1

certbot ×1

ctags ×1

glfw ×1

nginx ×1

opengl ×1

reactjs ×1

vim ×1