Reference Project

For convenience, we provide a reference project which implements all of the conventional user-flows for sign up, sign in and account management. Feel free to use this project to guide your implementation of django_flex_user.

You can try a live version of the reference project here. Or, you can run the reference project on your local machine.

Running the reference project locally

  1. Clone the git repository:

    $ git clone https://github.com/ebenh/django-flex-user
    $ cd django-flex-user
    
  2. Create an .env file with the following contents:

    DEBUG=1
    SECRET_KEY=NOT_FOR_PRODUCTION_x-)pi_7=*sqrnqeo!!p*986207*n4-!4xa&hd(lq&@@p0m=4*(
    SENDGRID_API_KEY=...
    SOCIAL_AUTH_FACEBOOK_KEY=...
    SOCIAL_AUTH_FACEBOOK_SECRET=...
    SOCIAL_AUTH_GOOGLE_OAUTH2_KEY=...
    SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET=...
    

    Note

    Replace ellipses with the values you obtain by following the instructions below:

    • For Sendgrid, click here to obtain an API key.

    • For Facebook Login, click here to obtain an “App ID” and “Secret Key”.

    • For Google Sign-In, click here to obtain an “OAuth Client ID” and “Client Secret”.

  3. Install dependencies:

    $ python3 -m pipenv install --dev
    

    Note

    On Windows, the command to execute Python is py.

  4. Activate the pipenv shell:

    $ python3 -m pipenv shell
    
  5. Initialize database tables:

    $ python3 manage.py migrate
    
  6. Create a super user:

    $ python3 manage.py createsuperuser
    
  7. Run the development server:

    $ python3 manage.py runserver
    
  8. Run tests:

    $ python3 manage.py test
    

    To run tests against multiple versions of Python and Django:

    $ python3 tox
    

    Note

    To skip Python interpreters which are not installed run tox --skip-missing-interpreters. To run tests against Python 3.8 only for example, run tox -e py38. To run tests against Python 3.8 and Django 3.2 only, run tox -e py38-django32.

  9. Build the Python package:

    $ python3 setup.py sdist
    
  10. Build the docs:

    $ cd doc
    $ sphinx-apidoc -o source ../django_flex_user ../django_flex_user/tests ../django_flex_user/migrations
    $ make html
    

    Note

    If you’re running Git Bash on Windows, the last command should be ./make.bat html