Git Product home page Git Product logo

prof's Introduction

prof

Full Django User Registration System (signup, login, logout, change username, change password, reset password)

prof version status python django

REQUIREMENTS

Notes

  • You can easily edit templates (or project).
  • Very simple and easy to use.
  • Created for educational purposes.

V2 What's New:

  • Api Added.
  • User List (You can view other users information).
  • More profile informations has been added, such as an Avatar.

Installation

  • Clone this repo and install requirements:

     $ git clone https://github.com/AI35/prof
     $ pip install -r requirements.txt
    

Configuration

settings.py:

  • INSTALLED_APPS :
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'prof',
    'crispy_forms',
    'six',
    'rest_framework',
    'profile_api',
]
  • TEMPLATES :
import os

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'prof/templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]
  • MIDDLEWARE:
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',
    'prof.middleware.ActiveUserMiddleware',
]
  • Add LOGIN_URL and DATA_UPLOAD_MAX_NUMBER_FIELDS :
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10240
LOGIN_URL = '/login/'
  • Add Media settings :
MEDIA_URL = '/media/'
MEDIA_ROOT=os.path.join(BASE_DIR,'prof/media')
  • Add Rest Framework settings :
REST_FRAMEWORK = {
    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
    'PAGE_SIZE': 10
}
  • Add EMAIL settings:
    • if you want use gmail account don't forget enable low secure app in your google account settings. (OUTDATED)
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = '*****'
EMAIL_PORT = 587
  • Enable/Disable Email verification:
    • if EMAIL_VERIFICATION = False a verification link will be displayed on the next page of registration.
EMAIL_VERIFICATION = True
  • Add cache settings :
CACHES = {
       'default': {
           'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
           'LOCATION': '127.0.0.1:11211',              
       }
   }

# Number of seconds of inactivity before a user is marked offline
USER_ONLINE_TIMEOUT = 300

# Number of seconds that we will keep track of inactive users for before 
# their last seen is removed from the cache
USER_LASTSEEN_TIMEOUT = 60 * 60 * 24 * 7

urls.py:

  • Project urls.py, not app urls :
from django.urls import path, include
from rest_framework import routers
from profile_api import views

router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)

#Django 4 Fix force_text
import django
from django.utils.encoding import force_str
django.utils.encoding.force_text = force_str

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('prof.urls')),
    path('api/', include(router.urls)),
    path('api/', include('rest_framework.urls', namespace='rest_framework')),
]

Run project:

  • First you need to create Database:
$ python manage.py makemigrations
$ python manage.py makemigrations prof
$ python manage.py migrate
  • Open 127.0.0.1:8000 in Browser
  • To use api go to 127.0.0.1:8000/api
ALI .B .OTH

prof's People

Contributors

ai35 avatar

Stargazers

 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.