carlosgg
carlosgg

Reputation: 321

Images are served by localhost but not when I deploy

I have been working on a GAE app, I had been referencing an image locally fine but when I deployed the app the image is missing!! I am using Windows Vista, FWIW. Here's my app.yaml:

application: pll3rdorder
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

- url: /static
  static_dir: static


- url: /download/noiseSources
  script: downloadNoiseSources.app

- url: /stylesheets
  static_dir: stylesheets

- url: .*
  script: main.app

libraries:
- name: webapp2
  version: "2.5.1"
- name: numpy
  version: "1.6.1"
- name: jinja2
  version: "2.6"

I am referring to the image like so:

<img type="image/png" class="image" src="/static/PLL_diagram2_small.png" />

For some reason that works locally but when I deploy, that image does not show up!

I am also using a CSS stylesheet and that DOES work both locally and when I deploy:

<link rel="stylesheet" type="text/css" href="/stylesheets/style.css" />

Stylesheets and images are both static files, so why does it work for one but not the other? I hope someone can illuminate me.

Upvotes: 3

Views: 3169

Answers (2)

Testilla
Testilla

Reputation: 692

For me, the problem was the filename format. I had the image file as equityLogo4.png and the image did not display on server. I changed the filename format to equity-logo.png and it fixed the problem.

Upvotes: 0

sebastian_oe
sebastian_oe

Reputation: 7320

Make sure that the filename PLL_diagram2_small.png exactly matches your url.

When you say that the image works on your Windows machine but not in the deployed version -- and considering that the filename contains uppercase and lowercase letters -- it is very likely that there's something wrong with the filename cases.

On your windows machine, your file system is probably not case-sensitive so that it will not recognize case errors in filenames.

The deployment system seems to be more strict, here.

Anyway, you provide only few information about the actual error. Maybe, you could state if the server gives you e.g. a 404 or provide a link to the problematic site (if it is available for public).

Upvotes: 2

Related Questions