Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
git clone https://github.com/fastai/fastai | |
cd fastai | |
conda create -n fastai python=3.6 anaconda | |
conda env update | |
# bash include source | |
# windows no source |
This file contains 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.db import models | |
class Note(models.Model): | |
title = models.CharField(max_length=20) | |
description = models.CharField(max_length=255) | |
note = models.TextField() # Actual note |
This file contains 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 rest_framework import serializers | |
from .models import Note | |
class NoteSerializer(serializers.ModelSerializer): | |
class Meta: | |
model = Note | |
fields = ['id', 'title', 'description', 'note'] |
This file contains 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 rest_framework import status # provides identifiers for each status code | |
from rest_framework.response import Response # determines the correct content type to return | |
from rest_framework.views import APIView | |
from .models import Note | |
from .serializers import NoteSerializer | |
class NoteApi(APIView): | |
# list or add Note instances |
This file contains 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.contrib import admin | |
from django.urls import path, include | |
urlpatterns = [ | |
path('admin/', admin.site.urls), | |
path('', include('myapiapp.urls')), | |
] |
This file contains 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.urls import path | |
from .views import NoteApi | |
urlpatterns = [ | |
path('api/notes', NoteApi.as_view()), | |
] |
This file contains 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
# this Dockerfile starts with a Python 3.6 parent image | |
FROM python:3.6 | |
# this means that Docker won’t buffer the output from your application; | |
# instead, you will see your output in your console | |
ENV PYTHONUNBUFFERED 1 # environment variable | |
# create a directory for our project in the container | |
RUN mkdir /code | |
# Set the working directory to /code |
This file contains 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
# REACT PROJECT SETUP | |
# this Dockerfile starts with a Node 12.2.0 parent image | |
FROM node:12.2.0 AS build | |
# Set the working directory to /code | |
WORKDIR /code | |
# Copies package.json and package-lock.json to Docker environment | |
COPY package*.json ./ | |
COPY yarn.lock ./ | |
COPY . . |
OlderNewer