Re: [Tutor] Unexpected result when running flask application.

2019-06-19 Thread Cameron Simpson

On 19Jun2019 09:54, Alan Gauld  wrote:

On 19/06/2019 05:18, Cravan wrote:
I am experiencing an unexpected result when I try to 
run my flask application.

The movie.html page prints out nothing except those in the . This appears 
on my webpage:


Note that the mail server does not allow (for security reasons)
binary attachments so we lost your image.


Cravan, you might find it useful to "View Source" of that page in your 
browser.


You can also use command line tools like "curl" or "wget" to directly 
fetch the page content.



However, your html files are not in HTML.
I'm not a Flask expert but every time I've used Flask the
html pages have been real HTML. Yours appear to be in some
strange pseudo markup language.


It is very common in Flask to write HTML pages using Jinja templates, 
which is what his examples look like.


Of course this adds more complexity, if he forgets to use Jinja to 
render the content to HTML before returning it.



If this is something unique to Flask then I suspect you will
need to ask on a Flask support page or list. It doesn't seem
to be a Python language related issue at this point.


He has, as it happens, over in fl...@python.org.

Cheers,
Cameron Simpson 
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Unexpected result when running flask application.

2019-06-19 Thread Alan Gauld via Tutor
On 19/06/2019 05:18, Cravan wrote:
> Hi all,
> 
> I am experiencing an unexpected result when I try to run my 
> flask application. 
> The movie.html page prints out nothing except those in the . This appears 
> on my webpage:

Note that the mail server does not allow (for security reasons)
binary attachments so we lost your image.

However, your html files are not in HTML.
I'm not a Flask expert but every time I've used Flask the
html pages have been real HTML. Yours appear to be in some
strange pseudo markup language.

If this is something unique to Flask then I suspect you will
need to ask on a Flask support page or list. It doesn't seem
to be a Python language related issue at this point.

And your layout.html template is virtually empty.
I think you need to write some valid HTML somewhere.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Unexpected result when running flask application.

2019-06-19 Thread Cravan
Hi all,

I am experiencing an unexpected result when I try to run my 
flask application. The movie.html page prints out nothing except those in the 
. This appears on my webpage:

I want it to print out all the stuff related to the movie in my sql table, e.g. 
year, runtime etc. How should I modify my code then? Also, when trying out 
search.html, it prints method not allowed for the requested URL. How should I 
rectify this?

Cravan

 

   {% extends "layout.html" %} {% block title %}

  ERROR 404 NOT FOUND

   [1]Retry!

   {% endblock %} {% block body %}

  ERROR 404 NOT FOUND

   {{message}} {% endblock %}

References

   Visible links
   1. file:///tmp/{{ url_for('login') }}
   {% extends "layout.html" %} {% block title %}

  ERROR 404 NOT FOUND

   [1]Retry!

   {% endblock %} {% block body %}

  ERROR 404 NOT FOUND

   [2]Logout!

   {{message}} {% endblock %}

References

   Visible links
   1. file:///tmp/{{ url_for('movies') }}
   2. file:///tmp/{{ url_for('logout') }}
   {% extends "layout.html" %} {% block title %} Login/Registration {%
   endblock %} {% block body %}

  Hi, welcome to Movie Reviewer. This website is created by yourfavouriteguy.
Kindly Login or Register first!

   Username:
   [1]_
   Password:
   [2]_
   [3]Confirm Registration!

   If you have registered, please login!
   Name:
   [4]_
   Password:
   [5]_
   [6]Login!
  {% block body %} {% endblock %}
   {% extends "layout.html" %} {% block title %} {% endblock %} {% block body
   %}

 Movie Details

   {% for lol in movie_title %}

 Title: {{lol.title}}
 Year: {{lol.year}}
 Runtime: {{lol.runtime}}
 ImdbID: {{lol.imdbID}}
 ImdbRating: {{lol.imdbRating}}

   {% endfor %}

   [1]Back!

   {% endblock %}

   [2]Logout!

References

   Visible links
   1. file:///tmp/{{ url_for('movies') }}
   2. file:///tmp/{{ url_for('logout') }}
   {% block body %}

 All Movies Related to Search:

 {% for movie in movie_specific %}
 * [1]Here's a movie called {{movie.title}} and lasts for
   {{movie.runtime}} minutes. It was shot in the year {{movie.year}} and
   has the imdbID of {{movie.imdbID}}. Its rating is
   {{movie.imdbRating}}. {% endfor %}

   [2]Back!

   [3]Logout!

   {% endblock %}

References

   Visible links
   1. file:///tmp/{{ url_for('movie', movie_title = movie.title) }}
   2. file:///tmp/{{ url_for('movies') }}
   3. file:///tmp/{{ url_for('logout') }}
   {% extends "layout.html" %} {% block title %} Movies {% endblock %} {%
   block body %}

   All Movies

   [1]Search for a movie

 {% for movie in movies %}
 * [2]Here's a movie called {{movie.title}} and lasts for
   {{movie.runtime}} minutes. It was shot in the year {{movie.year}} and
   has the imdbID of {{movie.imdbID}}. Its rating is
   {{movie.imdbRating}}. {% endfor %}

   [3]Logout!

   {% endblock %}

References

   Visible links
   1. file:///tmp/search.html
   2. file:///tmp/{{ url_for('movie', movie_title=movie) }}
   3. file:///tmp/{{ url_for('logout') }}
   {% extends "layout.html" %} {% block title %} {% endblock %} {% block body
   %}

Search:

   [1]_
   {% endblock %}

References

   Visible links
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor