title: Serving static files through apache
body: <p>I am new to the whole mod_wsgi and serving files through apache. I am really comfortable with flask but this is something i can't get my head around. I did the hello-world program and successfully displayed hello world!
  Now i wanted to display a image file. So I updated my hello-world.py to:</p>
  
  <pre><code>from flask import *
  yourflaskapp = Flask(__name__)
  
  @yourflaskapp.route("/")
  def hello():
      file="203.jpg"
      return render_template("hello.html",file=file)
  #   return"HEY"
  if __name__ == "__main__":
      yourflaskapp.run()
  </code></pre>
  
  <p>my directory structure is something like:/var/www/hello-world</p>
  
  <pre><code>/hello-world
      test.py
      yourflaskapp.wsgi
      /static
          -203.jpg
      /templates
          -hello.html
  </code></pre>
  
  <p>My template is simple:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;&lt;head&gt;&lt;title&gt;hi&lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;img src="{{url_for('static',filename=file)}}"/&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>and my apache conf file is:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
       WSGIDaemonProcess yourflaskapp
       WSGIScriptAlias / /var/www/hello-world/yourflaskapp.wsgi
       Alias /static/ /var/www/hello-world/static
       Alias /templates/ /var/www/hello-world/templates
       &lt;Directory /var/www/hello-world&gt;
              WSGIProcessGroup yourflaskapp
          WSGIApplicationGroup %{GLOBAL}
          Order deny,allow
          Allow from all
       &lt;/Directory&gt;
          &lt;Directory /var/www/hello-world/static&gt;
              Order allow,deny
              Allow from all
          &lt;/Directory&gt;
          &lt;Directory /var/www/hello-world/templates&gt;
              Order allow,deny
              Allow from all
          &lt;/Directory&gt;
       ErrorLog ${APACHE_LOG_DIR}/error.log
       LogLevel warn
       CustomLog ${APACHE_LOG_DIR}/access.log combined
   &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Though when i open the browser and head to my ip, it doesn't show the image file.
  What am i doing wrong? Is there any other approach i should follow?
  and if anyone could recommend any good links from where i can understand working with flask+mod_wsgi+apache2</p>