Answer the question
In order to leave comments, you need to log in
Flask blueprint subdomain?
There are two modules for the site itself and for the admin panel. One opens on www.site.ru , the other on admin.site.ru.
main = Blueprint('main', __name__, subdomain='www')
admin = Blueprint('admin', __name__, subdomain='admin')
Answer the question
In order to leave comments, you need to log in
Found the answer:
sub = Blueprint('sub', __name__, subdomain='<trademark>')
@sub.url_defaults
def add_trademark(endpoint, values):
values.setdefault('trademark', g.a_trademark)
@sub.url_value_preprocessor
def pull_trademark(endpoint, values):
g.a_trademark = values.pop('trademark')
query = City.query.filter(Company.url==g.a_trademark)
g.trademark = query.first_or_404()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question