d
d
djangorest-routes
Search…
⌃K

Quick Start

Good to know: Okaerinasai, buddy! Good to see that you made it here. I'll give you a few tips on how to get this package integrated into your project in no time! If you're one of those who prefer diving into the rabbit holes of documentation guides, you're welcome to do that here. If you're not like that kind of person, don't worry. You still will be guided!

Requirements

Oh, I forgot to mention! You're going to need the following to have this package integrated to your project:
  • Python (3.6, 3.7, 3.8, 3.9, 3.10)
  • Django (2.2, 3.0, 3.1, 3.2, 4.0)
That's right! You don't need to install djangorestframework, we've got you covered! *winks*

Install the library

The best way to install the package to your Django project is by using pip:
Python
# Install via pip
pip install --upgrade djangorest-routes

Register the library

Yosh! Next is registering the library to your project INSTALLED_APP setting:
Python
# Add rest_routes to your INSTALLED_APPS
INSTALLED_APPS = [
...
'rest_routes',
]
Now, don't forget to add rest_framework, rest_framework.authtoken, rest_framework_simplejwt, and corsheaders to your INSTALLED_APPS, since djangorest-routes creates its own magic based on them!
Next is, setting up rest_routes.User model to setting:
Python
# Set "rest_routes.User" to AUTH_USER_MODEL setting:
AUTH_USER_MODEL = "rest_routes.User
Set the length of the OTP code in your project settings, default is 6:
Python
# Default length is 6
OTP_LENGTH = 8
Include the OTP salt key in your project settings:
Python
# SALT_KEY: Do not expose in production
SALT_KEY = "some-secured-salt-key-for-otp-hashing"
Include the rest_routes URLs in your project urls.py:
Python
# Add rest_routes urls to your base urls
path('rest_routes/', include('rest_routes.urls')),
Yosh! What's next is running the command python manage.py migrate to create the djangorest_routes models, and start running your server. Visit http://127.0.0.1:8000/rest_routes/