Giter VIP home page Giter VIP logo

django-photo-gallery's Introduction

Django Photo Gallery Sample

Django Photo Gallery Sample Version

Summary

This sample contains a Django 2.0.x Image Gallery Site. The album images are optimized for performance. The Django Photo Gallery Sample is responsive and mobile/device friendly.

Django Photo Gallery Sample

Create an album from the Django admin panel

Albums can be created from the Django admin panel where one zip file with all the images should be selected from the PC. The Django Photo Gallery will resize the images to improve the picute load times and will also create thumbnail for every image in the zip.

Django Photo Gallery Sample

Tested with Django / Python

Python Django

Additional Django apps dependencies

  • Pillow
  • django-imagekit

Additional JavaScript apps dependencies

  • jquery
  • photoswipe

Prerequisites

Solution

Solution Author(s)
Django Photo Gallery Velin Georgiev (@VelinGeorgiev)

Version history

Version Date Comments
0.0.1 April 30, 2017 Initial commit
0.0.2 April 06, 2018 Updated to python 3.6 and Django 2.0.4
0.0.3 December 31, 2018 Updated to Django 2.1.4 and Django-material 1.4.3
0.0.4 July 19, 2019 Updated to Django 2.2.3

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.


Minimal Path to Awesome

  • Clone this repository.
  • Open the command line, navigate to the django app folder and execute:
    • virtualenv env (requires virtualenv), Mac virtualenv yourenv -p python3.6
    • Linux: source env/bin/activate, Windows: call env/Scripts/activate.bat, Mac source env/bin/activate
    • navigate to the django_photo_gallery folder using cd django_photo_gallery
    • execute pip install -r requirements.txt or pip3 install -r requirements.txt depending on your python installation.
    • If the Pillow fail to install on Windows, then install it manually pip install ../whl/Pillow-5.0.0-cp36-none-win32.whl (if you are not using python 3.6 32 bit then download the Pillow wheel for your python version).
    • Run python manage.py migrate or python3 manage.py migrate
    • Run python manage.py runserver or python3 manage.py runserver depending on your python installation
    • Open http://127.0.0.1:8000/ in web browser.
    • To access the admin forms go to http://127.0.0.1:8000/admin/ and enter user: admin, password: administrator

Features

This Sample illustrates the following concepts on top of the Django Framework:

  • Using django-material and materializecss for building Django UI.
  • Using django-imagekit for building resizing images.
  • Using photoswipe javascript library for more rich image gallery user experience.

Control the image size and quality

The picture size and quality can be controlled programatically from the models.py. Just change the processors. For more information see django-imagekit.

class AlbumImage(models.Model):
    image = ProcessedImageField(upload_to='albums', processors=[ResizeToFit(1280)], format='JPEG', options={'quality': 70})
    thumb = ProcessedImageField(upload_to='albums', processors=[ResizeToFit(300)], format='JPEG', options={'quality': 80})
    ...

Sample data cleanup

To cleanup the sample data delete the sql lite database and the media folder files. Create new database and run the sample again.

No validation on the form

This is sample. I decided to keep it simple and let the validation to be added by you.

Sharing is Caring

Star if you like it :)

django-photo-gallery's People

Contributors

dependabot[bot] avatar velingeorgiev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-photo-gallery's Issues

Customise the gallery

Hello, I am trying to make a gallery for a collection of images. Where should I upload the new images, and what changes should I make to the code so that the name, text description and thumb display is changed in the home screen.
Thanks in advance.

ImportError: cannot import name 'autodiscover'

Hey. I have installed all requirements, but every time i try to run python magage.py runserver I get this Exception. What can I do?

` File "C:\Users\DAVIDW1\PYCHAR1\DJANGO1\GLANGO1\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in call_with_frames_removed
File "C:\Users\DAVIDW1\PYCHAR1\DJANGO1\GLANGO1\lib\site-packages\imagekit_init
.py", line 3, in
from . import generatorlibrary
File "C:\Users\DAVIDW1\PYCHAR1\DJANGO1\GLANGO1\lib\site-packages\imagekit\generatorlibrary.py", line 1, in
from .registry import register
File "C:\Users\DAVIDW1\PYCHAR1\DJANGO1\GLANGO1\lib\site-packages\imagekit\registry.py", line 3, in
from .utils import autodiscover, call_strategy_method

ImportError: cannot import name 'autodiscover'
`
Thanks.
David

Click on thumbnail not showing full picture on the site

Tested with Python 3.6.0 and 3.6.1

Using the example application, and from the admin zone, I uploaded images and linked them to a gallery (either new or existing one).

In the admin zone, and from the Change form of. the image, both the full image and the thumbnail are visible via their respective links. But in the site, a click on the thumbnail doesn't show the full image.

Addition of new image and link to existing album
Capture d’écran 2019-07-19 à 06 45 52

Display both thumbnail and full image
Capture d’écran 2019-07-19 à 06 46 07
Capture d’écran 2019-07-19 à 06 46 01

Thumbnail correctly displayed on the site
Capture d’écran 2019-07-19 à 06 46 23

But not displayed in full size
Capture d’écran 2019-07-19 à 06 46 36
Capture d’écran 2019-07-19 à 06 46 28

Can't Upload Zip to the Albums

so all is fine, but when i try to uppload my archieve.zip i got this error.
do you know why?

Request Method: POST
http://127.0.0.1:8000/admin/app/album/6/change/
2.0.4
OSError
cannot identify image file <ContentFile: Raw content>
/usr/local/lib/python3.6/site-packages/PIL/Image.py in open, line 2585
/usr/local/opt/python/bin/python3.6
3.6.5
['/Users/Desktop/django-photo-gallery/django_photo_gallery', '/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', '/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6', '/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload', '/Users/Library/Python/3.6/lib/python/site-packages', '/usr/local/lib/python3.6/site-packages', '/usr/local/lib/python3.6/site-packages/email-6.0.0a1-py3.6.egg', '/usr/local/Cellar/numpy/1.14.3_1/libexec/nose/lib/python3.6/site-packages']
Thu, 2 Aug 2018 17:34:32 +0000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.