Giter Site home page Giter Site logo

drfx's Introduction

DRFx

A framework for launching new Django Rest Framework projects quickly. Comes with a custom user model, login/logout/signup, social authentication via django-allauth, and more.

Features

  • Django 3.1, Django REST Framework 3.12, and Python 3.8
  • Custom user model
  • Token-based auth
  • Signup/login/logout
  • django-allauth for social auth
  • Pipenv for virtualenvs

First-time setup

  1. Make sure Python 3.7x and Pipenv are already installed. See here for help.
  2. Clone the repo and configure the virtual environment:
$ git clone https://github.com/wsvincent/drfx.git
$ cd drfx
$ pipenv install
$ pipenv shell
  1. Set up the initial migration for our custom user models in users and build the database.
(drfx) $ python manage.py makemigrations users
(drfx) $ python manage.py migrate
(drfx) $ python manage.py createsuperuser
(drfx) $ python manage.py runserver
  1. Endpoints

Login with your superuser account. Then navigate to all users. Logout. Sign up for a new account and repeat the login, users, logout flow.


Want to learn more about Django REST Framework? I've written an entire book that takes a project-based approach to building web APIs with Django. The first 2 chapters are available for free online at https://djangoforapis.com/.

Django for APIs

drfx's People

Contributors

taimoorgit avatar wsvincent 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drfx's Issues

Warning: Your URL pattern '^api-auth/' has a route that contains '(?P<', begins with a '^', or ends with a '$'.

I am getting the following warning on my end when I run:

python manage.py makemigrations users

See the warning below:

WARNINGS:
?: (2_0.W001) Your URL pattern '^api-auth/' has a route that contains '(?P<', begins with a '^', or ends with a '$'. This was likely an oversight when migrating to django.urls.path().
Migrations for 'users':
  users/migrations/0001_initial.py
    - Create model CustomUser

TemplateResponseMixin required

Running your project as instructed gives me the following error the moment I go to the email confirmation URL:

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/api/v1/rest-auth/registration/account-confirm-email/MQ:1hn8GJ:GI8Jyq2Du5t8vL6dQ0Lhm8Jo2sI/

Django Version: 2.2
Python Version: 3.7.3
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'rest_framework',
 'rest_framework.authtoken',
 'rest_auth',
 'django.contrib.sites',
 'allauth',
 'allauth.account',
 'rest_auth.registration',
 'api',
 'users']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File "/home/coanda/.local/share/virtualenvs/drfx-ACbkk2Jq/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/home/coanda/.local/share/virtualenvs/drfx-ACbkk2Jq/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/home/coanda/.local/share/virtualenvs/drfx-ACbkk2Jq/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/coanda/.local/share/virtualenvs/drfx-ACbkk2Jq/lib/python3.7/site-packages/django/views/generic/base.py" in view
  71.             return self.dispatch(request, *args, **kwargs)

File "/home/coanda/.local/share/virtualenvs/drfx-ACbkk2Jq/lib/python3.7/site-packages/django/views/generic/base.py" in dispatch
  97.         return handler(request, *args, **kwargs)

File "/home/coanda/.local/share/virtualenvs/drfx-ACbkk2Jq/lib/python3.7/site-packages/django/views/generic/base.py" in get
  159.         return self.render_to_response(context)

File "/home/coanda/.local/share/virtualenvs/drfx-ACbkk2Jq/lib/python3.7/site-packages/django/views/generic/base.py" in render_to_response
  134.             template=self.get_template_names(),

File "/home/coanda/.local/share/virtualenvs/drfx-ACbkk2Jq/lib/python3.7/site-packages/django/views/generic/base.py" in get_template_names
  147.                 "TemplateResponseMixin requires either a definition of "

Exception Type: ImproperlyConfigured at /api/v1/rest-auth/registration/account-confirm-email/MQ:1hn8GJ:GI8Jyq2Du5t8vL6dQ0Lhm8Jo2sI/
Exception Value: TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()'

I assume this is likely due to allauth urls not being configured.

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.