Skip to content
A small picture gallery Vue app with Django backend.
Python Vue CSS JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
migrations
static
templates
tests
vue_app
.gitignore
LICENSE.md
README.md
__init__.py
admin.py
models.py
requirements.txt
routers.py
serializers.py
sitemap.py
urls.py
views.py

README.md

Gallery 657

A small picture gallery app with VueJs frontend and Django backend.

Setup

Pip requirements

pip install -r requirements.txt

Django settings

Add to your settings file.

SITE_ID = 1

add to the INSTALLED_APPS

    'django.contrib.sites',

    'rest_framework'

    'gallery657'

Add this restframework settings

  REST_FRAMEWORK {
    'DEFAULT_PAGINATION_CLASS':
        'rest_framework.pagination.PageNumberPagination',
    'PAGE_SIZE': 10,
    'DEFAULT_RENDERER_CLASSES': (
        'rest_framework.renderers.JSONRenderer',
        'rest_framework.renderers.BrowsableAPIRenderer'
    )
  }

Database configuration

python manage.py migrate

Django url

To the django projects' url.py add

from django.conf.urls import include
    url(r'^gallery657/', include('gallery657.urls', namespace="gallery657" ),

HTML

Where you want the app you put the div

<div id="gallery657" >
  <router-view></router-view>
</div>

where you whant the gallery to apear.

and preferbly put

<link rel="stylesheet" type="text/css" href="/static/css/gallery657/gallery_base.css" lazyload="">

in the header and

<script src="static/js/gallery657/dist/build.js" async=""></script>
<script src="static/js/gallery657/dist/build.js.map" async=""></script>

at the bottom of your base.html

Optional

Sitemap

Add to the INSTALLED_APPS

    'django.contrib.sitemaps',

To the django projects' url.py add

from django.contrib.sitemaps import views as sitemaps_views
from gallery657.sitemap import GallerySitemap
SITEMAPS = {
    'sitemaps': GallerySitemap
}

and add to the urlpatterns

    url(r'^sitemap\.xml$', sitemaps_views.index, {'sitemaps': SITEMAPS}),

For development

pip install pylint

To the Django settings.py add

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

To the Django project url.py add

from django.conf.urls.static import static

After the url patterns add, inclding the plus sign in the begining

if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

VueJS app building

sudo apt-get install npm

In the vue_app directory run:

npm install

and

npm run build

You can’t perform that action at this time.