Skip to content

manoelteixeira/user-management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask User Management

Content


Overview

This Flask application implements a basic user management system that can be used as a starting point for more compleplex Flask applications.

Features

  • Register
  • Loging
  • Logout
  • Change Password

Setup Instructions

Using venv:

  1. Clone repository:
    $ git clone https://github.com/manoelteixeira/user-management.git
  2. Create a new virtual environment:
    $ cd user-management
    $ python3 -m venv venv
  3. Activate virtual environment:
    $ source venv/bon/activate
  4. Install required python packages (specified in requirements.txt):
    (venv) $ pip install -r requirements.txt

Using Pipenv:

  1. Install Pipenv:
    $ pip install pipenv
  2. Clone repository:
    $ git clone https://github.com/manoelteixeira/user-management.git
  3. Create a new virtual environment and install required python packages:
    $ pipenv install

Running the Flask Application

Activate virtual environment:

  • venv:
    $ source venv/bon/activate
  • pipenv:
$ pipenv shell

Setup Flask environment variables:

  • Manual setup (need to be executed every time the virtual environment is activated):
    $ export APPLICATION_SETTINGS=../app_settings.cfg
    $ export FLASK_APP=app.py
    $ export FLASK_DEBUG=true
  • Automatic setup:
    1. Install python-dotenv:
      $ pip install python_dotenv
    2. Create a .env file and add:
      APPLICATION_SETTINGS=../app_settings.cfg
      FLASK_APP=app.py
      FLASK_DEBUG=true 
      

Database Initialization:

  • Using Flask command line command:

    flask init-db
  • Using Flask shell:

    flask shell
    from app import db
    import app.models
    
    db.drop_all() # if database file already exists
    db.create_all() # create all tables
    exit()

Running the application:

After activating the virtual environment, setting up the Flask virtual environments and initializing the database (if needed):

(venv) $ flask run

Key Python Modules Used

Testing

  1. Activate virtual environment
     $ source venv/bon/activate
    or
    $ pipenv shell
    
  2. Install pytest package:
    $ pip install --dev pytest
    or
    $ pipenv install --dev
    
  3. Running tests:
    $ python -m pytest -v

To Do

  • Email confirmation
  • Password recovery
  • Improve UX and UI

About

A simple example of a user management system in Flask

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published