I have a Flask app created, and my folder structure looks like this:
-- Folder
---- app.py
---- page.py
---- __init__.py
I'm trying to reference page.py as a class, using:
from flask import render_template
from flask import Flask, redirect, url_for
import logging
import json
import requests
import os
import page as Page
""" Initialise the app """
app = Flask(__name__)
@app.route("/")
def home():
return render_template('index.html')
if __name__ == "__main__":
app.run(debug=True)
But I get the error:
Cannot import 'page' due to syntax error 'invalid syntax (<unknown>, line 3)'pylint(syntax-error)
Where am I going wrong?
My class file looks like this:
class Page:
def __init__(self, title, environ)
self.title = title
self.environment = environ
I tried from .page import Page
but still got the error:
Cannot import 'page' due to syntax error 'invalid syntax (<unknown>, line 3)'pylint(syntax-error)