Skip to content

Latest commit

 

History

History
96 lines (74 loc) · 3.15 KB

README.md

File metadata and controls

96 lines (74 loc) · 3.15 KB

Basic boilerpate Register, Login and Logout. Python Backend and Vue.js Frontend

A SPA app with frontend made using Vue.js and backend in Python 3.8. This app has only 3 functions

  • Register - A component to register a new user
  • Login - A component to authenticate and generate a JWT for the user session
  • Logout - To invalidate the user session.

Documentation

A more detailed documentation can be found here: https://medium.com/@andrelbaldo/register-login-and-logout-boilerplate-written-in-vue-js-and-python-as-api-5ce57e33774b?source=friends_link&sk=4cdaa222f96dc4bd3a3a75eecf9eab97

Slack chanel

Join on our slack chanel: https://python-vue.slack.com/
Special thanks to Alex for creating it.

Getting Started

Clone the repository

git clone https://github.com/andrebaldo/python-vue-spa-boilerplate.git

Prerequisites

Installing

The installation is made in two steps, Backend and Frontend.

Database

If you don't have an SQL Server instance in your local machine you can install it downloading the "Microsoft SQL Server Express" or change the python file to point to a existing instance.

Copy the config.template.json file and name it to config.json, then edit the connection string accordingly with your database, here is an example for Microsoft SQL Server.

{
  "database_connection_string": "mssql://localhost/myDatabase?trusted_connection=yes&driver=SQL Server Native Client 11.0"
}

localhost: The computer address where the database is listening
myDatabase: The name of the database you want to use in this project
driver: The driver used to talk to the database server

Backend

Before you install the python dependencies you need to install the virtualenv and activate it, in order to do it please execute these commands one by one in a new command prompt window (cmd).

cd python-vue-spa-boilerplate\backend
pip install virtualenv
virtualenv venv
cd venv\Scripts\
activate
cd ..
cd ..

Using the same command prompt, go to the backend folder (if you are not in there yet) and run the pip install requirements.txt command

pip install -r ./requirements.txt

Once the pip have installed all the dependencies you need to create the database structure, to do it there is python script that does it for you, just execute this command:

python databaseCreation.py

If you didn't get any error, you can run the backend API using this command below:

python app.py

You can check if the API is running accessign the address http://localhost:5000/home you should receive Unauthorized message, if you got it the API is runing.

Now let us start the Frontend

Frontend

Open a new command prompt and go to the frontend folder.

cd python-vue-spa-boilerplate\frontend
npm i
yarn serve

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details