title: Loading media files from a network drive in Django with Apache
body: <p>I have a django page where I am trying to add a banner images which is stored in a network drive.</p>
  <p>In Dev environment:</p>
  <p><strong>setting.py</strong> :</p>
  <p>MEDIA_URL = '/media/'</p>
  <p>MEDIA_ROOT = PureWindowsPath('//shared drive/folder/').drive</p>
  <p><strong>urls.py</strong>:</p>
  <p>urlpatterns = [</p>
  <pre><code>path('admin/', admin.site.urls),
  ......
  ......
  </code></pre>
  <p>]</p>
  <p>urlpatterns += static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)</p>
  <p><strong>models.py</strong>:</p>
  <p>class WelcomePage(models.Model):
  departmentname = models.CharField(max_length=100,blank=True,null=True)
  bannerimage = models.ImageField(upload_to='DjangoPortal/welcome/images/',blank=True)</p>
  <p><strong>home.html</strong>:</p>
  <pre><code>        &lt;div class=&quot;card border-secondary mb-3&quot;&gt;
              &lt;div class=&quot;card-body&quot; style=&quot;padding: 0px !important;&quot;&gt;
                  &lt;img src=&quot;{{ pagedata.bannerimage.url }}&quot; width=&quot;100%&quot; /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  <p>with the above settings the page works perfectly</p>
  <p>In Production:</p>
  <p>All the above settings remains the same. In <strong>settings.py</strong> DEBUG =False and ALLOWED_HOSTS=[prod server ip, localhost]</p>
  <p>In <strong>httpd.conf</strong> I added below</p>
  <p>Define MEDIAROOT &quot;//shared drive/folder/&quot;</p>
  <p>Alias /media &quot;${MEDIAROOT}&quot;</p>
  <p>&lt;Directory &quot;${MEDIAROOT}&quot;&gt;</p>
  <p>Require all granted</p>
  <p>&lt;/Directory&gt;</p>
  <p>but the image is not loading.
  I am getting below error on Apache restart</p>
  <p>**
  AH00526: Syntax error on line 562 of C:/Apache24/conf/httpd.conf:
  &lt;Directory '//shared drive/folder/'&gt; path is invalid.**</p>
  <p>Am I doing anything wrong?</p>
  <p>The technology specification is Windows Server 2012 R2 + Python 3.9 + Django 3.0.1 + SQL Server+ Apachelounge 2.4</p>
  <p>Please guide if you have worked on or aware of this kind of scenario.</p>