Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

460
Vistas
Frozen-Flask errors while running cProfile

Building my static site (which uses Flask-Frozen to freeze a Flask app) works fine, but when I tried to profile it with python -m cProfile athena.py, I get the error

PermissionError: [Errno 13] Permission denied: '/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/build

ie Frozen-Flask is trying to create its build folder in python's home folder on my system, not my current working directory. (Even though I am using a venv! which python yields /path/to/dir/bin/python.)

I was able to circumvent this by instantiating my Flask app with a hardcoded root path:

athena = Flask(__name__, root_path='/path/to/dir')

But then I get this error:

MissingURLGeneratorWarning: Nothing frozen for endpoints page, hardpagelink. Did you forget a URL generator?

Trying to narrow down the issue with a debugger, I see that pages yields an empty list while profiling, and a list of pages in regular mode, which makes me suspect that the index is not being generated, or is generated somewhere else.

In addition there are some differences in my config (which is just generated from __name__):

Profiling config: 'DEBUG': False, 'FLATPAGES_AUTO_RELOAD': 'if debug', 'FLATPAGES_EXTENSION': '.html'

Regular config: 'DEBUG': True, 'FLATPAGES_AUTO_RELOAD': True, 'FLATPAGES_EXTENSION': '.md', 'FREEZER_BASE_URL': 'http://localhost/', 'FREEZER_REMOVE_EXTRA_FILES': False

Here is the gist of my code (full code is here):

from flask import Flask, render_template
from flask_flatpages import FlatPages
from flask_frozen import Freezer
from flask_static_compress import FlaskStaticCompress

DEBUG = True
FLATPAGES_AUTO_RELOAD = DEBUG
FLATPAGES_EXTENSION = ".md"
FREEZER_REMOVE_EXTRA_FILES = False
FREEZER_BASE_URL = "http://localhost/"

athena = Flask(__name__)
athena.config.from_object(__name__)
pages = FlatPages(athena)
freezer = Freezer(athena)

@athena.route("/")
def index():
    posts = [page for page in pages if "ispage" not in page.meta]
    hpages = [page for page in pages if "ispage" in page.meta]
    return render_template(
        "index.html", pages=posts, hpages=hpages)


@athena.route("/<path:path>/")
def hardpagelink(path):
    hpage = ""
    for page in pages:
        if page.path == path:
            if page.meta["ispage"]:
                hpage = page
    hpages = [page for page in pages if "ispage" in page.meta]
    return render_template("hard.html", page=hpage, hpages=hpages)


@athena.route("/posts/<path:path>/")
def page(path):
    page = pages.get_or_404(path)
    hpages = [page for page in pages if "ispage" in page.meta]
    return render_template("page.html", page=page, hpages=hpages)


if __name__ == "__main__":
    freezer.freeze()

If anyone wants to reproduce this here are instructions for setting up an env:

git clone https://github.com/lordgrenville/athena.git
cd athena/
brew install jez/formulae/pandoc-sidenote
# or cabal install pandoc-sidenote
npm install -g less
python3 -m venv blogenv/ && source blogenv/bin/activate
pip install werkzeug pypandoc virtualenv flask-flatpages frozen-flask pandoc-crossref flask-static-compress feedgen
python athena.py build
python -m cProfile athena.py build  # fails
over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda