flacon plan modèle de dossier

Ma gourde application de mise en page est:

myapp/
    run.py
    admin/
        __init__.py
        views.py
        pages/
            index.html
    main/
        __init__.py
        views.py
        pages/
            index.html

_init_.py fichiers sont vides. admin/views.py contenu est:

from flask import Blueprint, render_template
admin = Blueprint('admin', __name__, template_folder='pages')

@admin.route('/')
def index():
    return render_template('index.html')

main/views.py est similaire à admin/views.py:

from flask import Blueprint, render_template
main = Blueprint('main', __name__, template_folder='pages')

@main.route('/')
def index():
    return render_template('index.html')

run.py est:

from flask import Flask
from admin.views import admin
from main.views import main

app = Flask(__name__)
app.register_blueprint(admin, url_prefix='/admin')
app.register_blueprint(main, url_prefix='/main')

print app.url_map

app.run()

Maintenant, si j'ai accès http://127.0.0.1:5000/admin/, il affiche correctement admin/index.html.
Cependant, http://127.0.0.1:5000/main/ montre encore admin/index.html au lieu de main/index.html. J'ai vérifié app.url_map:

<Rule 'admin' (HEAD, OPTIONS, GET) -> admin.index,
<Rule 'main' (HEAD, OPTIONS, GET) -> main.index,

Aussi, j'ai vérifié que l'indice de la fonction dans main/views.py est appelé comme prévu.
Si je renomme main/index.html pour quelque chose de différent, alors il fonctionne. Donc, sans
renommage, comment pouvons réaliser que 1http://127.0.0.1:5000/main/1 montre main/index.html?

InformationsquelleAutor synergetic | 2011-11-02