New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It breaks with SERVER_NAME defined #36

Closed
iurisilvio opened this Issue Aug 29, 2013 · 4 comments

Comments

Projects
None yet
2 participants
@iurisilvio

iurisilvio commented Aug 29, 2013

I'm trying to freeze my app, I get a ValueError when SERVER_NAME is defined.

SERVER_NAME = 'www.example.com'

The url_for try to generate the external URL without scheme (://www.example.com). I'm using Flask 0.10.1 and last Frozen-Flask.

@SimonSapin

This comment has been minimized.

Show comment
Hide comment
@SimonSapin

SimonSapin Aug 29, 2013

Collaborator

Please provide steps to reproduce, expected outcome, and actual outcome.

Collaborator

SimonSapin commented Aug 29, 2013

Please provide steps to reproduce, expected outcome, and actual outcome.

@iurisilvio

This comment has been minimized.

Show comment
Hide comment
@iurisilvio

iurisilvio Sep 1, 2013

Here, the steps to reproduce the issue:

>>> import flask
>>> app = flask.Flask(__name__)
>>> @app.route('/')
... def index(): return 'index'
...
>>> from flask_frozen import Freezer
>>> f = Freezer(app)
>>> n = f._generate_all_urls()
>>> next(n)
(u'/', 'index')
>>> app.config['SERVER_NAME'] = 'www.example.com'
>>> n = f._generate_all_urls()
>>> next(n)
(u'://www.example.com/', 'index')
>>> f.freeze()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\flask_frozen\__init__.py", line 149, in freeze
    new_filename = self._build_one(url)
  File "C:\Python27\lib\site-packages\flask_frozen\__init__.py", line 263, in _build_one
    % (response.status, url))
ValueError: Unexpected status '404 NOT FOUND' on URL ://www.example.com/

iurisilvio commented Sep 1, 2013

Here, the steps to reproduce the issue:

>>> import flask
>>> app = flask.Flask(__name__)
>>> @app.route('/')
... def index(): return 'index'
...
>>> from flask_frozen import Freezer
>>> f = Freezer(app)
>>> n = f._generate_all_urls()
>>> next(n)
(u'/', 'index')
>>> app.config['SERVER_NAME'] = 'www.example.com'
>>> n = f._generate_all_urls()
>>> next(n)
(u'://www.example.com/', 'index')
>>> f.freeze()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\flask_frozen\__init__.py", line 149, in freeze
    new_filename = self._build_one(url)
  File "C:\Python27\lib\site-packages\flask_frozen\__init__.py", line 263, in _build_one
    % (response.status, url))
ValueError: Unexpected status '404 NOT FOUND' on URL ://www.example.com/

@SimonSapin SimonSapin closed this in ecb1d8b Sep 1, 2013

@SimonSapin

This comment has been minimized.

Show comment
Hide comment
@SimonSapin

SimonSapin Sep 1, 2013

Collaborator

I’m not sure if this was always broken or if this something changed in recent Flask versions, but it should be fixed now. Please let me know if this fixes the issue for you.

Collaborator

SimonSapin commented Sep 1, 2013

I’m not sure if this was always broken or if this something changed in recent Flask versions, but it should be fixed now. Please let me know if this fixes the issue for you.

@iurisilvio

This comment has been minimized.

Show comment
Hide comment
@iurisilvio

iurisilvio Sep 2, 2013

Thanks, it works for me.

iurisilvio commented Sep 2, 2013

Thanks, it works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment