1

I'm a bit new to python and I'm trying to learn Flask.

My project structure looks like this:

project/
   __init__.py
   views/
       __init__.py
       profile.py

My project/__init__.py looks like this:

from flask import Flask
from views.profile import app
app = Flask(__name__)

I'm trying to import app from project/__init__.py intoprofile.py.

I've tried some ways that none of them worked.

Steve
  • 1,553
  • 2
  • 20
  • 29
ali73
  • 415
  • 1
  • 5
  • 17

1 Answers1

2

Finally I found an answer which works:

In my profile.py I put this:

import sys, os.path
sys.path.append(os.path.abspath('../'))
from ccs import app 
ali73
  • 415
  • 1
  • 5
  • 17
  • [please try this](http://stackoverflow.com/questions/32786300/maya-how-to-create-python-scripts-with-more-than-one-file/32794372#32794372) – Sanyal Aug 16 '16 at 12:57