This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "title": "Skazani na Shawshank", | |
| "year": 1994 | |
| }, | |
| { | |
| "title": "Ojciec chrzestny", | |
| "year": 1972 | |
| }, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div id="app"> | |
| <h1>IMDb Top Rated Movies</h1> | |
| <ul> | |
| <li v-for="movie in movies"> | |
| {{ movie.title }} <em>{{ movie.year }}</em> | |
| </li> | |
| </ul> | |
| </div> | |
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Failed to load http://127.0.0.1:8000/: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8080' is therefore not allowed access. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # movies/urls.py | |
| from django.conf.urls import include, url | |
| from .views import top_rated | |
| urlpatterns = [ | |
| url(r'^$', top_rated, name='top-rated'), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.http import JsonResponse | |
| def top_rated(request): | |
| return JsonResponse( | |
| [ | |
| { | |
| 'title': 'Skazani na Shawshank', | |
| 'year': 1994 | |
| }, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # backend/urls.py | |
| from django.conf.urls import include, url | |
| from django.contrib import admin | |
| urlpatterns = [ | |
| url(r'^', include('movies.urls')), | |
| url(r'^admin/', admin.site.urls), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INSTALLED_APPS = [ | |
| # ... | |
| 'django.contrib.staticfiles', | |
| 'movies' | |
| ] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # run Vue.js 2 development server (default port 8080) | |
| npm run dev | |
| # run Django development server (default port 8000) | |
| python manage.py runserver |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Zmieniamy | |
| INSTALLED_APPS = [ | |
| # ... | |
| 'django.contrib.staticfiles', | |
| 'corsheaders', | |
| 'movies' | |
| ] | |
| # Zmieniamy | |
| MIDDLEWARE = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ng new blogpost | |
| cd blogpost | |
| yarn add bootswatch |