title: Python - Flask: Static folder outside root directory
body: <p>Just for fun, I am trying to understand how I can create  a website with <code>Python</code> and <code>Flask</code>. That website has to run on my own computer and I will be the only client. So far I got most things I want to do working, but now  I encounter a technical problem that I cannot solve.</p>
  
  <p>On the client side I want to display images that are returned by the server. In <code>my __init__.py</code> I placed <code>app = Flask(__name__, static_url_path='/static')</code> and in my html document <code>&lt;img src="/static/images/2012035.jpg" height="150px"&gt;</code>. This works like a charm.</p>
  
  <p>But in fact, my images are in a directory <code>d:\genealogie\documenten</code>, which is outside the application directory and I do not want to copy more than 2000 files to the directory <code>static/images</code>. </p>
  
  <p>I tried:</p>
  
  <pre><code>documenten = "d:\genealogie\documenten"
  os.mkdir(documenten)
  </code></pre>
  
  <p>which gives a <code>WinError 183</code> because the directory already exists.</p>
  
  <p>I also tried:</p>
  
  <pre><code>documenten = "d:\genealogie\documenten"
  app = Flask(__name__, static_url_path='documenten')
  </code></pre>
  
  <p>which gives a <code>ValueError</code>: urls must start with a leading slash.</p>
  
  <p>I have seen quite a lot of similar questions here, but unfortunately I was unable to see how I could use the answers for my specific problem. Can I configure the website in such a way that I as a user can ask for say <code>&lt;img src="documenten/2012035.jpg" height="150px"&gt;</code>, maybe with some or other <code>localhost</code> prefix? Any help is highly appreciated.</p>
  
  <p><em>EDIT</em></p>
  
  <p>What I want to do is to give the server access to directories that are outside the directory of the server. Maybe I can illustrate that by showing how easily this can be done in <code>WAMP</code>. There we only need to add a few lines to the file <code>httpd.conf</code>. For example:</p>
  
  <pre><code>Include "C:/wamp64/alias/*"
  
  Alias /adressen "d:/adressen" 
  &lt;Directory "d:/adressen"&gt;
      Options Indexes FollowSymLinks Multiviews
      AllowOverride all
      Require all granted
  &lt;/Directory&gt;
  
  Alias /genealogie "d:/genealogie" 
  &lt;Directory "d:/genealogie"&gt;
      Options Indexes FollowSymLinks Multiviews
      AllowOverride all
      Require all granted
  &lt;/Directory&gt;
  </code></pre>
  
  <p>The server and all its files are in <code>c:/wamp64</code> and its subdirectories. But when we include <code>&lt;img src="http://localhost/genealogie/documenten/doc1064.jpg"&gt;</code> and <code>&lt;img src="http://localhost/adressen/doc5127.jpg"&gt;</code> in an <code>html</code> document, both images are nicely displayed, despite the fact that physically they reside far outside <code>WAMP</code>, even on different drives. So my question is: can we do this with <code>FLASK</code> as well?</p>