Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
html error 404
#1
I am getting the html error 404 and I don'y know why. I set it up as follows -
FlaskBlog
    |
    |--main
    |   |--__init__.py
    |   
    |--posts
    |   |--__init__.py
    |   |--forms.py
    |
    |--static
    |   |--a css file and directory full of pictures
    |
    |--Templates
    |    |--A ton of html templates
    |
    |--users
    |   |--__init__.py
    |   |--forms.py
    |   |--utils.py
    |
    |--__init__.py
    |--models.py
    |--site.db
run.py
Here is the code for run.py
from flaskblog import create_app

app = create_app()

if __name__ == '__main__':
    app.run(debug=True)
The code for flaskblog.__init__
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt as bc
from flask_login import LoginManager
from flask_mail import Mail
import os

db = SQLAlchemy()
bc = bc()
login_manager = LoginManager()
login_manager.login_view = 'users.login'
login_manager.login_message_category = 'info'
mail = Mail()

def create_app():
    app = Flask(__name__)

    SECRET_KEY = os.environ.get('SECRET_KEY')
    SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI')
    MAIL_SERVER = 'smtp.googlemail.com'
    MAIL_PORT = 587
    MAIL_USE_TLS = True
    MAIL_USERNAME = os.environ.get('EMAIL_USER')
    MAIL_PASSWORD = os.environ.get('EMAIL_PASS')

    db.init_app(app)
    bc.init_app(app)
    login_manager.init_app(app)
    mail.init_app(app)

    from flaskblog import main
    from flaskblog import users
    from flaskblog import post

    main.add_routes(app)
    users.add_routes(app)
    post.add_routes(app)

    return app
In the main, users, and post folders, each of their __init__ functions has a function call add_routes which take the parameter app. The function creates a blueprint, creates routes with the blueprint, and then registers it at the end of the code. the forms are just forms for filling out specific things. and utils has send_mail and save_picture in it. models contains the User and Post class, children to db.Model. Thanks in advance for your help.
Reply
#2
You should try your sample with a different email provider
because google has a lot of securities like catchas
which you have solve from time to time.
And google has his own interpretation of smtp, pop3 and imap.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  HTML multi select HTML listbox with Flask/Python rfeyer 0 4,536 Mar-14-2021, 12:23 PM
Last Post: rfeyer
  TDD/CSS & HTML testing - CSS selector (.has-error) makoseafox 0 1,775 May-13-2020, 07:41 PM
Last Post: makoseafox
  Python3 + BeautifulSoup4 + lxml (HTML -> CSV) - How to loop to next HTML/new CSV Row BrandonKastning 0 2,329 Mar-22-2020, 06:10 AM
Last Post: BrandonKastning
  BeautifulSoup: Error while extracting a value from an HTML table kawasso 3 3,156 Aug-25-2019, 01:13 AM
Last Post: kawasso
  [Flask] html error 405 SheeppOSU 0 2,319 Jun-08-2019, 04:42 PM
Last Post: SheeppOSU

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020