Giter VIP home page Giter VIP logo

reactjs-auth-django-rest's Introduction

A React/Redux Authentication Demo Site, using DjangoRestFramework/DjangoRestAuth

-It is a good demonstration of how to integrate react/redux with django-rest-framework to build a fully functional web application.

-It can also serve as a starter template for building a variety of web applications that needs authentication.

Backend:

  • django 1.11
  • django-rest-framework 3.7
  • django-rest-auth 0.9.2

Frontend:

  • webpack
  • React v16
  • React Router 4
  • Redux
  • reactstrap (Bootstrap 4 components)

How to use it

Clone the repository, which includes both backend and frontend.

Backend: Django, Django Rest Framework and Django-Rest-Auth

cd to django_backend directory

create your virtualenv and activate (python3) under win: python -m venv 'envname'

run pip install -r requirements.txt to install all django dependencies.

run python manage.py migrate to migrate database.

run python manage.py runserver to start django development server to serve the demo site.

the backend server should be localhost:8000.

Frontend: React/Redux

all JavaScript and html source code are within react_src directory, bundle.js will be generated in static/js directory. index.html will be generated in templates/project directory.

run npm install to install all node dependencies.

run npm run start to start the webpack dev server for frontend app.

now you can go to localhost:8083 to access the main page of the demo site.

Issue Reporting

If you have found a bug or feature request, please report them at the repository issues section.

License

MIT

reactjs-auth-django-rest's People

Contributors

cipiasentini avatar lixiandai avatar zachliugis 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

Watchers

 avatar  avatar  avatar  avatar  avatar

reactjs-auth-django-rest's Issues

email activation link

I cloned and tested this project and it is working fine but when we signup we are getting email but after that how to verified for the login purpose .

thank you.

Too Old not working more.

This repo is too old and not compatible with latest version of django, django-rest-framework, and react-js

Deploy to Heroku

How would we deploy to Heroku since the root level doesn't include the package.json or manage.py files?

Response error from Django server

I am trying to run the application and i am getting this error "Error logging in XMLHttpRequest { onreadystatechange: [310]</</noop(), readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, responseURL: "http://localhost:8000/rest-auth/reg…", status: 500, statusText: "INTERNAL SERVER ERROR", responseType: "", response: "AttributeError at /rest-auth/registration/
can't set attribute". It occurs during registering new user.

500 Error for "sign-up" (AttributeError at /rest-auth/registration/ can't set attribute)

Hi,

Great work :)

I keep getting a 500 error whenever I try to sign-up.

When I go (via the web site) to sign up- it gives me the following error:

`AttributeError at /rest-auth/registration/
can't set attribute

Request Method: POST
Request URL: http://localhost:8000/rest-auth/registration/
Django Version: 1.8.6
Python Executable: /Users/mac1/Dev/MeMail/AuthDjangoReact/venv/bin/python
Python Version: 2.7.10
Python Path: ['/Users/mac1/Dev/MeMail/AuthDjangoReact', '/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python27.zip', '/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7', '/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/plat-darwin', '/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/plat-mac', '/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/Extras/lib/python', '/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/lib-tk', '/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/lib-old', '/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/site-packages']
Server time: Fri, 30 Sep 2016 04:10:57 +0000
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'rest_framework',
'rest_framework.authtoken',
'rest_auth',
'allauth',
'allauth.account',
'allauth.socialaccount',
'rest_auth.registration',
'corsheaders')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'corsheaders.middleware.CorsMiddleware')

Traceback:
File "/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response

  1.                 response = wrapped_callback(request, _callback_args, *_callback_kwargs)
    
    File "/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
  2.     return view_func(_args, *_kwargs)
    
    File "/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/site-packages/django/views/generic/base.py" in view
  3.         return self.dispatch(request, _args, *_kwargs)
    
    File "/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  4.         response = self.handle_exception(exc)
    
    File "/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  5.         response = handler(request, _args, *_kwargs)
    
    File "/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/lib/python2.7/site-packages/rest_auth/registration/views.py" in post
  6.     self.request.POST = self.request.data.copy()
    

Exception Type: AttributeError at /rest-auth/registration/
Exception Value: can't set attribute
Request information:
GET: No GET data

POST: No POST data

FILES: No FILES data

COOKIES:
phpbb3_kq7c7_sid = '75684fc3ed6ae9eea3599780faf84e6a'
phpbb3_cx3ie_k = ''
phpbb3_lmvi3_u = '2'
phpbb3_1lx7q_k = ''
tabstyle = 'html-tab'
xf_session = 'f1c02e13fb4d351ccf513abe34660cd5'
style_cookie = 'null'
PHPSESSID = '7e770881247e829eabb511d1ed42069f'
phpbb3_9hfdg_sid = '3828b3f5190669f1a56892d0a60622c8'
_csrf = 'c006056360802eb868f1527a4e462a162d1c62f2f3b285f8e4397d56801ca7b6a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22YRkUvW4IXK9SpxnmRqITUGm85HFQqvbB%22%3B%7D'
phpbb3_1lx7q_u = '1'
phpbb3_cx3ie_u = '1'
xf_session_admin = '84a5171efc6aa7aab587cd3901fcde64'
SQLiteManager_currentLangue = '2'
phpbb3_kq7c7_u = '2'
phpbb3_lmvi3_k = ''
phpbb3_a9vvk_k = ''
phpbb3_cx3ie_sid = 'e1204923ddffc36834f053065eb4768f'
languages = '%5B%22en-US%22%2C%22en%22%5D'
phpbb3_3ep3z_u = '2'
phpbb3_a9vvk_u = '2'
phpbb3_1lx7q_sid = '2620d45d213308c8d98a8edfcf051cd0'
phpbb3_kq7c7_k = ''
xf_edit_style_id = '2'
phpbb3_p2agf_sid = 'b360526754acb5ba313a7ff84efb02a9'
phpbb3_3ep3z_sid = 'e1abcdb6d0db310d1cc188d7c3fd6e4c'
qdPM8 = 'be76e019d47c117e60a97d2a51bdaa21'
_ga = 'GA1.1.453835675.1454028111'
phpbb3_9hfdg_k = ''
phpbb3_9hfdg_u = '1'
sessionid = 'z7c8ig9yraxkxj9xfu3oya3tqjkwa3vw'
flarum_session = 'a33789a3e1496311e6ecfcb7ec300c8d'
csrftoken = 'YU0cGSQX86enr5dTxoqMUlkzMBwrNZzo'
phpbb3_a9vvk_sid = '468e67547d65103871a2b5d68f8d5807'
phpbb3_lmvi3_sid = '5f9e68eab56160ab107eb649d487fe56'
phpbb3_p2agf_u = '1'
phpbb3_3ep3z_k = ''
phpbb3_p2agf_k = ''

META:
wsgi.version =
wsgi.multiprocess = False
RUN_MAIN = 'true'
HTTP_REFERER = 'http://localhost:8000/signup'
VERSIONER_PYTHON_PREFER_32_BIT = 'no'
SERVER_SOFTWARE = 'WSGIServer/0.1 Python/2.7.10'
TERM_PROGRAM_VERSION = '361.1'
REQUEST_METHOD = 'POST'
LOGNAME = 'mac1'
USER = 'mac1'
NVM_DIR = '/Users/mac1/.nvm'
PATH = '/Users/mac1/Dev/MeMail/AuthDjangoReact/venv/bin:/usr/local/heroku/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/tools:/platform-tools:/Applications/Postgres.app/Contents/Versions/latest/bin'
QUERY_STRING = ''
HOME = '/Users/mac1'
HTTP_ORIGIN = 'http://localhost:8000'
PS1 = '(venv)\h:\W \u$ '
wsgi.errors = <open file '', mode 'w' at 0x1081071e0>
TERM_PROGRAM = 'Apple_Terminal'
LANG = 'en_AU.UTF-8'
VIRTUAL_ENV = '/Users/mac1/Dev/MeMail/AuthDjangoReact/venv'
SHELL = '/bin/bash'
TZ = 'UTC'
HTTP_COOKIE = 'xf_edit_style_id=2; phpbb3_p2agf_u=1; phpbb3_p2agf_k=; phpbb3_p2agf_sid=b360526754acb5ba313a7ff84efb02a9; phpbb3_a9vvk_u=2; phpbb3_a9vvk_k=; phpbb3_a9vvk_sid=468e67547d65103871a2b5d68f8d5807; phpbb3_cx3ie_u=1; phpbb3_cx3ie_k=; phpbb3_cx3ie_sid=e1204923ddffc36834f053065eb4768f; phpbb3_1lx7q_u=1; phpbb3_1lx7q_k=; phpbb3_1lx7q_sid=2620d45d213308c8d98a8edfcf051cd0; xf_session=f1c02e13fb4d351ccf513abe34660cd5; xf_session_admin=84a5171efc6aa7aab587cd3901fcde64; phpbb3_lmvi3_u=2; phpbb3_lmvi3_k=; phpbb3_lmvi3_sid=5f9e68eab56160ab107eb649d487fe56; style_cookie=null; phpbb3_3ep3z_u=2; phpbb3_3ep3z_k=; phpbb3_3ep3z_sid=e1abcdb6d0db310d1cc188d7c3fd6e4c; phpbb3_kq7c7_u=2; phpbb3_kq7c7_k=; phpbb3_kq7c7_sid=75684fc3ed6ae9eea3599780faf84e6a; qdPM8=be76e019d47c117e60a97d2a51bdaa21; phpbb3_9hfdg_u=1; phpbb3_9hfdg_k=; phpbb3_9hfdg_sid=3828b3f5190669f1a56892d0a60622c8; _csrf=c006056360802eb868f1527a4e462a162d1c62f2f3b285f8e4397d56801ca7b6a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22YRkUvW4IXK9SpxnmRqITUGm85HFQqvbB%22%3B%7D; PHPSESSID=7e770881247e829eabb511d1ed42069f; flarum_session=a33789a3e1496311e6ecfcb7ec300c8d; SQLiteManager_currentLangue=2; _ga=GA1.1.453835675.1454028111; tabstyle=html-tab; languages=%5B%22en-US%22%2C%22en%22%5D; sessionid=z7c8ig9yraxkxj9xfu3oya3tqjkwa3vw; csrftoken=YU0cGSQX86enr5dTxoqMUlkzMBwrNZzo'
SERVER_NAME = '1.0.0.127.in-addr.arpa'
VERSIONER_PYTHON_VERSION = '2.7'
SHLVL = '1'
XPC_FLAGS = '0x0'
wsgi.url_scheme = 'http'
_ = './manage.py'
SERVER_PORT = '8000'
PATH_INFO = u'/rest-auth/registration/'
CONTENT_LENGTH = '77'
TERM_SESSION_ID = 'E7C47C77-9CF9-45CD-994F-3315D70EEEE6'
SSH_AUTH_SOCK = '/private/tmp/com.apple.launchd.oYubPRzCNo/Listeners'
HTTP_X_REQUESTED_WITH = 'XMLHttpRequest'
XPC_SERVICE_NAME = '0'
TERM = 'xterm-256color'
wsgi.input = <socket._fileobject object at 0x10a6259d0>
Apple_PubSub_Socket_Render = '/private/tmp/com.apple.launchd.aZCf8HLRui/Render'
HTTP_HOST = 'localhost:8000'
SCRIPT_NAME = u''
wsgi.multithread = True
HTTP_CONNECTION = 'keep-alive'
TMPDIR = '/var/folders/g9/yn33k6vn7h1115hscd4rqh8w0000gn/T/'
HTTP_ACCEPT = 'application/json, text/javascript'
NVM_IOJS_ORG_MIRROR = 'https://iojs.org/dist'
HTTP_USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36'
GATEWAY_INTERFACE = 'CGI/1.1'
wsgi.run_once = False
CSRF_COOKIE = u'YU0cGSQX86enr5dTxoqMUlkzMBwrNZzo'
OLDPWD = '/Users/mac1/Dev/MeMail'
REMOTE_ADDR = '127.0.0.1'
HTTP_ACCEPT_LANGUAGE = 'en-US,en;q=0.8'
__CF_USER_TEXT_ENCODING = '0x1F5:0x0:0x0'
PWD = '/Users/mac1/Dev/MeMail/AuthDjangoReact'
SERVER_PROTOCOL = 'HTTP/1.1'
DJANGO_SETTINGS_MODULE = 'project.settings'
CONTENT_TYPE = 'application/x-www-form-urlencoded'
wsgi.file_wrapper = ''
REMOTE_HOST = ''
HTTP_ACCEPT_ENCODING = 'gzip, deflate'
NVM_RC_VERSION = ''
NVM_NODEJS_ORG_MIRROR = 'https://nodejs.org/dist'

Settings:
Using settings module project.settings
SECURE_BROWSER_XSS_FILTER = False
USE_THOUSAND_SEPARATOR = False
ACCOUNT_AUTHENTICATION_METHOD = 'username'
CSRF_COOKIE_SECURE = False
LANGUAGE_CODE = 'en-us'
ROOT_URLCONF = 'project.urls'
MANAGERS =
BASE_DIR = '/Users/mac1/Dev/MeMail/AuthDjangoReact'
SILENCED_SYSTEM_CHECKS = []
DEFAULT_CHARSET = 'utf-8'
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
ACCOUNT_EMAIL_REQUIRED = False
ALLOWED_HOSTS = []
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
EMAIL_SUBJECT_PREFIX = '[Django] '
SERVER_EMAIL = 'root@localhost'
SECURE_HSTS_SECONDS = 0
STATICFILES_FINDERS =
SESSION_CACHE_ALIAS = 'default'
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_NAME = 'sessionid'
TIME_INPUT_FORMATS =
SECURE_REDIRECT_EXEMPT = []
DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'AUTOCOMMIT': True, 'ATOMIC_REQUESTS': False, 'NAME': '/Users/mac1/Dev/MeMail/AuthDjangoReact/db.sqlite3', 'CONN_MAX_AGE': 0, 'TIME_ZONE': 'UTC', 'OPTIONS': {}, 'HOST': '', 'USER': '', 'TEST': {'COLLATION': None, 'CHARSET': None, 'NAME': None, 'MIRROR': None}, 'PASSWORD': u'', 'PORT': ''}}
EMAIL_SSL_KEYFILE = u'**
'
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
FILE_UPLOAD_PERMISSIONS = None
FILE_UPLOAD_HANDLERS =
DEFAULT_CONTENT_TYPE = 'text/html'
APPEND_SLASH = True
LOCALE_PATHS =
DATABASE_ROUTERS = []
DEFAULT_TABLESPACE = ''
YEAR_MONTH_FORMAT = 'F Y'
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
CACHES = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CORS_ORIGIN_REGEX_WHITELIST =
SESSION_COOKIE_PATH = '/'
SECURE_CONTENT_TYPE_NOSNIFF = False
MIDDLEWARE_CLASSES =
USE_I18N = True
THOUSAND_SEPARATOR = ','
SECRET_KEY = u'**
'
CORS_ORIGIN_WHITELIST =
DEFAULT_INDEX_TABLESPACE = ''
LOGGING_CONFIG = 'logging.config.dictConfig'
TEMPLATE_LOADERS =
FIRST_DAY_OF_WEEK = 0
WSGI_APPLICATION = 'project.wsgi.application'
TEMPLATE_DEBUG = False
X_FRAME_OPTIONS = 'SAMEORIGIN'
CSRF_COOKIE_NAME = 'csrftoken'
FORCE_SCRIPT_NAME = None
USE_X_FORWARDED_HOST = False
EMAIL_TIMEOUT = None
SECURE_SSL_HOST = None
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_DOMAIN = None
FILE_CHARSET = 'utf-8'
DEBUG = True
LANGUAGE_COOKIE_DOMAIN = None
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
INSTALLED_APPS =
LANGUAGES =
USE_L10N = True
STATIC_ROOT = None
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
STATICFILES_DIRS = '/Users/mac1/Dev/MeMail/AuthDjangoReact/static'
PREPEND_WWW = False
SECURE_PROXY_SSL_HEADER = None
LANGUAGE_COOKIE_AGE = None
SESSION_COOKIE_HTTPONLY = True
DEBUG_PROPAGATE_EXCEPTIONS = False
CSRF_COOKIE_AGE = 31449600
MONTH_DAY_FORMAT = 'F j'
LOGIN_URL = '/accounts/login/'
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
TIME_FORMAT = 'P'
AUTH_USER_MODEL = 'auth.User'
DATE_INPUT_FORMATS =
AUTHENTICATION_BACKENDS = 'django.contrib.auth.backends.ModelBackend'
EMAIL_HOST_PASSWORD = u'**
'
PASSWORD_RESET_TIMEOUT_DAYS = u'**
'
SESSION_FILE_PATH = None
CACHE_MIDDLEWARE_ALIAS = 'default'
SESSION_SAVE_EVERY_REQUEST = False
NUMBER_GROUPING = 0
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
CSRF_COOKIE_PATH = '/'
LOGIN_REDIRECT_URL = '/accounts/profile/'
DECIMAL_SEPARATOR = '.'
IGNORABLE_404_URLS =
MIGRATION_MODULES = {}
TEMPLATE_STRING_IF_INVALID = ''
LOGOUT_URL = '/accounts/logout/'
EMAIL_USE_TLS = False
FIXTURE_DIRS =
EMAIL_HOST = 'localhost'
DATE_FORMAT = 'N j, Y'
MEDIA_ROOT = ''
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
ADMINS =
FORMAT_MODULE_PATH = None
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
REST_FRAMEWORK = {'DEFAULT_THROTTLE_RATES': {'anon': '100/day', 'user': '1000/day'}, 'DEFAULT_AUTHENTICATION_CLASSES': ('rest_framework.authentication.TokenAuthentication',), 'DEFAULT_THROTTLE_CLASSES': ('rest_framework.throttling.AnonRateThrottle', 'rest_framework.throttling.UserRateThrottle')}
MEDIA_URL = ''
DATETIME_FORMAT = 'N j, Y, P'
TEMPLATE_DIRS =
SITE_ID = 1
DISALLOWED_USER_AGENTS =
ALLOWED_INCLUDE_ROOTS =
LOGGING = {}
SHORT_DATE_FORMAT = 'm/d/Y'
TEMPLATES = [{'DIRS': ['/Users/mac1/Dev/MeMail/AuthDjangoReact/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']}, 'BACKEND': 'django.template.backends.django.DjangoTemplates'}]
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
CACHE_MIDDLEWARE_KEY_PREFIX = u'**
***'
SECURE_SSL_REDIRECT = False
TIME_ZONE = 'UTC'
CORS_ORIGIN_ALLOW_ALL = False
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
LANGUAGE_COOKIE_NAME = 'django_language'
EMAIL_USE_SSL = False
TEMPLATE_CONTEXT_PROCESSORS =
SESSION_COOKIE_AGE = 1209600
SETTINGS_MODULE = 'project.settings'
USE_ETAGS = False
LANGUAGES_BIDI =
FILE_UPLOAD_TEMP_DIR = None
INTERNAL_IPS =
STATIC_URL = '/static/'
EMAIL_PORT = 25
USE_TZ = True
SHORT_DATETIME_FORMAT = 'm/d/Y P'
TEST_NON_SERIALIZED_APPS = []
PASSWORD_HASHERS = u'**
*****************'
ABSOLUTE_URL_OVERRIDES = {}
LANGUAGE_COOKIE_PATH = '/'
REST_SESSION_LOGIN = False
CACHE_MIDDLEWARE_SECONDS = 600
EMAIL_SSL_CERTFILE = None
CSRF_COOKIE_HTTPONLY = False
DATETIME_INPUT_FORMATS =
EMAIL_HOST_USER = ''

You're seeing this error because you have DEBUG = True in your
Django settings file. Change that to False, and Django will
display a standard page generated by the handler for this status code.`

chaining user_details data to login

@ZachLiuGIS would you recommend chaining a call for user details to a successful login, or somehow merging the serializers? I would like to get the user data and set it to state as soon as a user logs in, so that I can display their name.

The extended User class UserProfile does not generate fully when a user account is created

BACKEND in user_profile module

When a user account is created, a new user record is added to the database, but the extension table does not create a new record to track additional user information (website and bio). Which create an issue during the update of user information.

To fix this issue, I added a signal which create a new record for the extended class each time a user is created.

The signals.py file I added to the app to solve the issue:
`from django.db.models.signals import post_save
from django.dispatch import receiver

from .models import UserProfile
from django.contrib.auth.models import User

@receiver(post_save, sender=User, dispatch_uid='save_new_user_profile')
def save_profile(sender, instance, created, **kwargs):
user = instance
if created:
profile = UserProfile(user=user)
profile.save()`

you might need additional instructions about how to make this work by checking this tuto: https://simpleisbetterthancomplex.com/tutorial/2016/07/28/how-to-create-django-signals.html

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.