Hello community, If i want to log into my control panel am getting 400 bad request error that says:
*Bad Request* The browser (or proxy) sent a request that this server could not understand. I have also a search form , if i want to search for something through the database, am getting the *same error* . The site is working on Apache webserver, what really interesting is that, if a ran the application using the *runserver* command, the error won't show any more just in Apache the error showing up . Here is how the code looks like in my *views.py*: @app.route('/login/', methods=('GET', 'POST')) @auth.login_required def login(): if session.get('username') or session.get('is_author') == True: flash("Already logged in .") return redirect(url_for('index')) form = LoginForm() error = None if request.method == 'GET' and request.args.get('next'): session['next'] = request.args.get('next') if form.validate_on_submit(): user = User.query.filter_by( username = form.username.data ).first() if user: if bcrypt.hashpw(form.password.data, user.password) == user.password: session['username'] = form.username.data session['is_author'] = user.is_author if 'next' in session: next = session.get('next') session.pop('next') return redirect(next) else: flash('Welcome back %s'%session['username'].upper()) return redirect(url_for('index')) else: error = "Incorrect username or password ." flash(error) else: flash(error) error = "Incorrect username or username ." return render_template('auth/login.html', form=form) Also the search code in *views.py:* def replace_last(source_string, replace_what, replace_with): head, sep, tail = source_string.rpartition(replace_what) return head + replace_with + tail @app.route('/search/<query>', methods=['GET','POST']) def search_engine(query): user = User.query.first() try: query = request.form['autocomplete'] r = replace_last(query, ' ', '') posts = Post.query.filter(Post.title.like('%'+r+'%')).order_by(Post.publish_date.desc()) except TypeError: flash('No results.') return render_template('main/search_form.html') context = { "posts":posts, "r":r, "user":user, "query":query } return render_template('main/search_form.html', **context) Another thing to mention is that, my site is running under *HTTPS *, maybe this causing some problems, i really don't know !! , in fact am using Letsencrypt, in another article I've seen the people are saying that there's a certain problem when using flask and HTTPS especially when using requests like POST or GET, but i really deleted Letsencrypt from my server restarted Apache but that didn't solved the problem , am really frustrated don't know what to do. Eventually, please any help would be a millions appreciated . -- You received this message because you are subscribed to the Google Groups "pocoo-libs" group. To unsubscribe from this group and stop receiving emails from it, send an email to pocoo-libs+unsubscr...@googlegroups.com. To post to this group, send email to pocoo-libs@googlegroups.com. Visit this group at https://groups.google.com/group/pocoo-libs. For more options, visit https://groups.google.com/d/optout.