Forums

Flask app - html pages seem to be modified upon deployment

Hi -- really like the PythonAnywhere concept. I have deployed my web app but the html seems to being modified upon deployment.

My html code before deployment (snippet only):

<p>
    <a href="/search_recipe">
        <img border="0" alt="Just Eat It" src="./static/Food_splash_screen_JEI1.jpg" class="img-responsive"
             alt="Responsive image">
    </a>
</p>

then when I inspect the rendered code (this is the / route for my page):

<img style="-webkit-user-select: none;background-position: 0px 0px, 10px 10px;background-size: 20px 20px;background-image:linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee 100%),linear-gradient(45deg, #eee 25%, white 25%, white 75%, #eee 75%, #eee 100%);cursor: zoom-in;" src="http://mjboothaus.pythonanywhere.com/" width="453" height="680">

and there is no action link of .../search_recipe

so the image just displays and I can't click on it. PLEASE HELP!

Did you reload your web app?

Hi Glenn

Thanks for getting back -- yes I reload after every change I make. I'm very puzzled.

App works fine locally - seems that something is happening in the "wrapping of the app" for deployment.

Thanks, Michael

I'm not entirely sure what you mean by "deployment". Are you developing locally and then uploading to PythonAnywhere? Have you checked the files that PythonAnywhere is serving? Are they what you expect?

Sorry - should have been clearer...

By deployment I mean I am taking my code which is running (happily) on my local machine and pushing it (via Git) to PA.com.

Then I create a web app pointing it to the appropriate code and virtualenv and then I press the "reload" button (after any change I make) and it still doesn't work.

The first page (index i.e. '/' route) shows the splash screen graphic which has an action on click to go to href="/search_recipe.

All that happens then is that the image is displayed but it is not clickable to go to the /search_recipe page.

Hopefully this is clearer.

Is it a problem with saying the image is static in the web app setup?

Cheers, Michael

So I worked it out:

I had a static link defined to the splash screen image which I thought from reading the help text (on the Web tab) was advised to help with faster loading.

I deleted the link and it all works fine now.

Perhaps the help text for that section could be "sharpened". Cheers!

Using the static files system for images definitely should speed things up. How had you set it up?