Code Monkey home page Code Monkey logo

chriswilson1982 / flask-mongo-app Goto Github PK

View Code? Open in Web Editor NEW
28.0 3.0 6.0 71 KB

This is a template for a web app using Flask and MongoDB. It uses Flask-Login for authentication, Flask-Pymongo for the database connection, Flask-Bcrypt for password hashing and Flask-Talisman for security. The front-end uses Bootstrap and Font Awesome. The app features user verification by email, basic note recording and messaging between users.

Home Page: https://demo.chriswilson.app

License: MIT License

Python 37.36% CSS 0.75% JavaScript 10.69% HTML 51.17% Procfile 0.04%
python flask mongodb pymongo bcrypt flask-pymongo flask-bcrypt flask-login fontawesome bootstrap

flask-mongo-app's Introduction

Template for a basic web app using Python Flask and MongoDB

This is a template for a web app using Flask and MongoDB. It uses Flask-Login for authentication, Flask-Pymongo for the database connection, Flask-Bcrypt for password hashing and Flask-Talisman for security. The front end uses Bootstrap for styling. The app features user verification by email, basic note recording and messaging between users with email notifications.

How to use the template

Simply insert your MongoDB database URI and database name in the configuration.ini file. You can also add SMTP server login details to support sending registration emails and message notifications to users.

Run the app using the terminal command: python run.py

Live demo

The app is live for demonstration purposes at demo.chriswilson.app.

flask-mongo-app's People

Contributors

chriswilson1982 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flask-mongo-app's Issues

login/logout breaks with flask debugs disabled

Hello, Chris

I've been playing with this template of yours and it is quite well written and works very well.
One issue was discovered though.

Apparently, once debug is disabled (or if the script is used with waitress):
app.run(host='0.0.0.0', port=8080, debug=False)
and redirects to https are also disabled to make it work around that forced https redirect:
talisman = Talisman(app, content_security_policy=csp, force_https=False)

then the login/logout functionality breaks completely. There is no errors, and nothing in the logs. If you were logged in before disabling debugs the logout is not possible. Otherwise the login fails but not due to password error. It just does not go to the target ("next") page and stays on the same login page.

Any advise is appreciated, these two steps above reliable reproduce the issue with your app template

Thanks

Igor

How do I initialize the DB?

Thanks for the great repository, Chris!

I'm getting an error when I try to sign up as a new user:

File "/var/www/convers.ai/python/flask-mongo-app/run.py", line 118, in register
    users = mongo.db.users
AttributeError: 'NoneType' object has no attribute 'users'

I've never worked with MongoDB before. But I suspect it's because my database is empty, i.e. has no columns?

Any command I need to run in order to initialize the database?

The DB itself seems to be working. I successfully ran this:

from pymongo import MongoClient
client = MongoClient(host = ["127.0.0.1:27017"])
client.server_info()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.