I am a bit confused on how to utilize blueprints in flask. Let me show you what I would like to do:
First of all, my project must have the following structure:
run.py
application
-- __init.py__
-- admin
-- -- templates
-- -- -- index.html
-- -- static
-- -- -- img
-- -- -- -- logo.png
-- -- models.py
-- -- views.py
-- landing
-- -- templates
-- -- -- index.html
-- -- static
-- -- -- img
-- -- -- -- logo.png
-- -- models.py
-- -- views.py
What I would like to do is define two blueprints in such a way that when I visit /admin
the application/admin/templates/index.html
page (and the corresponding logo) gets loaded but when I visit /landing
the application/landing/templates/index.html
page (and the corresponding logo) gets loaded.
This shouldn't be that difficult but I get confused for some reason.
Any help is appreciated!
EDIT
more specifically, does the following use of blueprints and jinja2 make sense? it doesn't seem to work as expected...
$.backstretch([
"{{ url_for('landing.static' , filename='img/bg/01.jpg') }}",
"{{ url_for('landing.static' , filename='img/bg/02.jpg') }}",
"{{ url_for('landing.static' , filename='img/bg/03.jpg') }}"
], {duration: 3000, fade: 750});
127.0.0.1 - - [31/Aug/2015 16:47:42] "GET /%7B%7B%20url_for('landing.static'%20,%20filename='img/bg/01.jpg')%20%7D%7D HTTP/1.1" 404 -
127.0.0.1 - - [31/Aug/2015 16:47:42] "GET /%7B%7B%20url_for('landing.static'%20,%20filename='img/bg/02.jpg')%20%7D%7D HTTP/1.1" 404 -
127.0.0.1 - - [31/Aug/2015 16:47:42] "GET /%7B%7B%20url_for('landing.static'%20,%20filename='img/bg/03.jpg')%20%7D%7D HTTP/1.1" 404 -