Answer the question
In order to leave comments, you need to log in
Flask-admin changes url on redirects how to fix?
Good time of the day.
The problem is that when you go to the administrative part (and just on redirects in a non-administrative part), the path is changed. so to speak!
I can’t find words to explain, I’ll better demonstrate:
the hoster has a server, flask is raised on it, the settings are as follows:
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ cgi-bin/flask-wrapper.fcgi/$1 [QSA,L]
#!/home/profel/python/bin/python
# -*- coding: utf-8 -*-
import sys, os
reload(sys)
sys.setdefaultencoding('utf8')
# Add a custom Python path.
sys.path.insert(0, "/home/profel/site/")
# Switch to the directory of your project. (Optional.)
os.chdir("/home/profel/site/")
from flup.server.fcgi import WSGIServer
from app import app
if __name__ == '__main__':
WSGIServer(app).run()
Answer the question
In order to leave comments, you need to log in
I found the answer myself!
And it lies in the fact that it is necessary to read the mana more carefully !!! :(
. I don't have access to Apache settings, so the option is:
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
<Files ~ (\.fcgi)>
SetHandler fcgid-script
Options +FollowSymLinks +ExecCGI
</Files>
</IfModule>
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ cgi-bin/flask-wrapper.fcgi/$1 [QSA,L]
</IfModule>
#!/home/profel/python/bin/python
# -*- coding: utf-8 -*-
import sys, os
reload(sys)
sys.setdefaultencoding('utf8')
sys.path.insert(0, ' /home/profel/site/')
from flup.server.fcgi import WSGIServer
from app import app
class ScriptNameStripper(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
environ['SCRIPT_NAME'] = ''
return self.app(environ, start_response)
app = ScriptNameStripper(app)
if __name__ == '__main__':
WSGIServer(app).run()
import sys, os
reload(sys)
sys.setdefaultencoding('utf8')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question