[Fixed]-How to share a folder in django development server depyloment

1๐Ÿ‘

โœ…

I think you mean, is to serve static files:

https://docs.djangoproject.com/en/1.8/howto/static-files

Basicly what you need to do is define 2 settings in your settings.py:

  • STATICFILES_DIRS (which dirโ€™s do you want to serve these files from)
  • STATIC_URL (what url do you want this folder to map to?)

for example:

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, "static"),
    '/var/www/static/',
)

STATIC_URL = '/static/'

now you can access /var/www/static/image.jpg by visiting localhost:8000/static/image.jpg

๐Ÿ‘คuser1797792

Leave a comment