Giter Club home page Giter Club logo

django2's Introduction

Django-Next

A basic, full-stack web application

Django-Next contains a backend Django app that features restful api endpoints.
It also contains a Next.js app for the frontend which fetches data from the api.

Table Of Contents

Features

  • ๐Ÿ›ข Backend API endpoints using Django Rest Framework
  • โœ… Initial data loaded with one command through fixtures
    • To checkout the documentation, click the fixtures link and find loaddata in the contents sidebar.
    • The mock data was created using mockaroo
  • ๐ŸŽจ Sleek frontend styling with Material-UI
  • ๐ŸŽฌ Basic transitions and animations with Framer Motion

Quick Start

1. Clone repository

git clone https://github.com/Brlaney/django-next.git

2. Setup the backend Dj-api

cd dj-api

# Activate a virtual environment
virtualenv ll_env
ll_env\scripts\activate.bat

# Download necessary packages
py -m pip install Django djangorestframework django-cors-headers

# Make database migrations
py manage.py makemigrations
py manage.py migrate 

# Create admin superuser
py manage.py createsuperuser
..<input a username, email, and password>

# Populate your database with initial data from the dj-api/api/fixtures directory
py manage.py loaddata fixture

The terminal should output: Installed 30 object(s) from 1 fixture(s). If an error message appears then run py manage.py migrate --run-syncdb and py manage.py migrate first and then py manage.py loaddata fixture should work.

3. Confirm your backend is functioning

py manage.py runserver

Now navigate to http://127.0.0.1:8000/api and confirm the initial data was loaded properly.

screenshot-of-api


4. Setup the frontend next-app

Open up another terminal (tab or window) and keep your backend running.

# In the new terminal cd into the next-app directory
cd next-app

# Install all dependencies
yarn install 

# or if using npm
npm install

# Create a .env.local file with backend api endpoint inside
echo > .env.local

# In your text editor put the following line in your .env.local file
DJANGO_API=http://localhost:8000/api

# Start your frontend app
yarn dev

# or
npm run dev

Opening http://localhost:3000/ in your browser should now show your frontend Next.js app.

Connect with me

License

MIT License

Copyright (c) 2021 Brendan Laney - Django-Next author.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Contributions and issues

I would love your feedback on my project - please feel free to make a pull request or submit an issue if you find any. Thanks for checking out my project!

django2's People

Contributors

brlaney avatar

Watchers

 avatar

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.