Skip to content

guilhermewebdev/django-login

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Login

This project goal is to show a login example using Django and React.

How to setup in development mode:

Requirements:

After installing the requirements, you need to clone this repository. You can download the code clicking here, or install git following this instructions and running this command:

    git clone https://github.com/guilhermewebdev/django-login.git

With the project in your machine, you need to create a .env file with database credentials, this file needs to be created into directory /<Project Path>/server/api/, in there you can find sensitive data about the project, such as the database credentials and secret key in this format:

/<Project Path>/server/api/.env

    DB=<Database name>
    DB_USER=<Database username>
    DB_PASS=<Database password>
    DB_HOST=<Database host>
    SECRET_KEY=<Django secret key>

Read more about Django Secret Key here. The database credentials are configured into docker-compose.yml file, present in the project root, the default is:

    DB=database
    DB_USER=user
    DB_PASS=password
    DB_HOST=172.25.20.15

With the project configured, you can build the containers, run the following command into project directory to do it:

    docker-compose build

After build is successful, migrate the database running this command:

    docker-compose exec backend pypy3 manage.py migrate

The project is now ready to run, and to do it you can run this command:

    docker-compose up

If the database connection fails, try pressing CTRL + C to stop, and run it again. Or if it's successful open http://localhost/ in your browser and see the project running.

Screen Gif