Skip to content

aribfp/ars

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImageField Sample Application

This an implementation of a tiny image gallery site with single Django application "gallery".

It is meant as an example for my blog post: Django Image and File Field Caveats

Setup and Run

python3 -m venv venv             # Create new virtual environment
. venv/bin/activate              # Activate the new environment
pip install -r requirements.txt  # Install required packages
cd apps
./manage.py migrate              # Create DB tables
./manage.py runserver            # Run development server

You can access the gallery application on the following URL: http://localhost:8000/

Gallery application

Most of the code exists under "apps/gallery", including the model, views, url routing (urls.py), and templates.

settings.py changes

Changes in "apps/apps/settings.py":

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, '..','www','media')

urls.py changes

from django.conf import settings
from django.conf.urls.static import static
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 45.0%
  • HTML 35.7%
  • JavaScript 19.3%