Skip to content

premanand17/django-pydgin-auth

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pydgin-auth

Pydgin-auth is a Django app to manage user authentication and authorization. It uses Django’s user authentication system to handle user accounts, groups, permissions, and cookie-based user sessions.

Quick start

  1. Installation:

    pip install -e git://github.com/D-I-L/django-pydgin-auth.git@develop#egg=pydgin-auth
  2. If you need to start a Django project:: (skip this if you are adding to existing project)

    django-admin startproject [project_name]

  3. Add "pydgin-auth" to your INSTALLED_APPS in settings.py:

    INSTALLED_APPS = (
        ...
        'pydgin-auth'
       )
  4. Add the following lines to your project settings.py:

    AUTH_PROFILE_MODULE = "pydgin_auth.UserProfile"
    # Import Applicaton-specific Settings
    PYDGIN_AUTH_APPS_BASE_NAME = 'pydgin_auth'
    for app in INSTALLED_APPS:
        if app.startswith(PYDGIN_AUTH_APPS_BASE_NAME):
            try:
                app_module = __import__(app, globals(), locals(), ["settings"])
                app_settings = getattr(app_module, "settings", None)
                for setting in dir(app_settings):
                    if setting == setting.upper():
                        locals()[setting] = getattr(app_settings, setting)
            except ImportError:
                pass
  5. Create users and databases:

    sudo -u postgres psql -c "CREATE USER webuser WITH PASSWORD 'webuser';"
    sudo -u postgres psql -c "ALTER USER webuser CREATEDB;"
    
    sudo -u postgres psql -c "CREATE database pydgin_authdb;"
    sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE "pydgin_authdb" TO webuser;"
  6. Migrations - Clear migrations if you already have created them:

    find $PYENV_HOME -name "000*" -exec rm -rf {} \;
    find $WORKSPACE/pydgin -name "000*" -exec rm -rf {} \;
    
    eg: find /gdxbase/www/xxx-dev/python-env/[VIRTUAL_ENV]/lib/python3.4/site-packages/ -name "000*" -exec rm -rf {} \;
    eg: find /gdxbase/www/xxx-dev/pydgin/pydgin/ -name "000*" -exec rm -rf {} \;
  7. Migrations - Makemigrations:

    ./manage.py makemigrations
    ./manage.py migrate
    
    ./manage.py makemigrations elastic
    ./manage.py migrate elastic
  8. Import test usernames and permissions:

    psql webuser -h localhost -d pydgin_authdb -f ../$PYENV_HOME/src/pydgin_auth/pydgin_auth/static/pydgin_auth/data/pydgin_authdb_data.sql
    eg: psql webuser -h localhost -d pydgin_authdb -f ../python-env/pydgin_dev/src/pydgin_auth/pydgin_auth/static/pydgin_auth/data/pydgin_authdb_data.sql
    (Note: password is webuser)
  9. Run the server::

    ./manage runserver xxxx-rh1:8000

  10. Tests can be run as follows:

    ./manage.py test pydgin_auth.tests 
    ./manage.py test auth_test.tests
  11. Test site:: Viist site http://xxxx-rh1:8000/ Login and try to access auth_test home at http://xxxx-rh1:8000/auth_test/

About

Authentication and authorisation app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 68.8%
  • HTML 23.5%
  • JavaScript 7.3%
  • CSS 0.4%