jstacoder / flask-cms

a minimal CMS built on the pythonic MTV (model / template / view) pattern, implemented using the flask webframework
136 stars 37 forks source link

ImportError: No module named core #3

Closed ondoheer closed 10 years ago

ondoheer commented 10 years ago

One more ;-) Core.views doesn't find core.init to load the blueprint

File "manage.py", line 11, in from app import app File "/var/www/flask-cms/flask_cms/app.py", line 12, in app = AppFactory(DevelopmentConfig).get_app(name) File "/var/www/flask-cms/flask_cms/main/factory.py", line 40, in get_app self._register_blueprints() File "/var/www/flask-cms/flask_cms/main/factory.py", line 91, in _register_blueprints module, b_name = self._get_imported_stuff_by_path(blueprint_path) File "/var/www/flask-cms/flask_cms/main/factory.py", line 49, in _get_imported_stuff_by_path module = import_string(module_name) File "/home/ondoheer/.virtualenvs/flask-cms/lib/python2.7/site-packages/werkzeug/utils.py", line 426, in import_string sys.exc_info()[2]) File "/home/ondoheer/.virtualenvs/flask-cms/lib/python2.7/site-packages/werkzeug/utils.py", line 408, in import_string return import(import_name) File "/var/www/flask-cms/flask_cms/core/init.py", line 12, in from views import * File "/var/www/flask-cms/flask_cms/core/views.py", line 8, in from .core import core werkzeug.utils.ImportStringError: import_string() failed for 'core'. Possible reasons are:

Debugged import:

Original exception:

ImportError: No module named core

jstacoder commented 10 years ago

hmm i think that should be

from . import core

or

from core import core

ill recommit it with the relative import, that should fix it.

jstacoder commented 10 years ago

i tested it on my end and it works with the relative import,

from . import core

let me know if your still having trouble.

ondoheer commented 10 years ago

I tried that too before opening the issue,

can it be it's doing a circular import? since views is importing core and core is importing views?

File "/var/www/flask-cms/flask_cms/core/__init__.py", line 12, in <module>
    from views import *
  File "/var/www/flask-cms/flask_cms/core/views.py", line 13, in <module>
    from .forms import MarkdownEditor,ColumnForm
werkzeug.utils.ImportStringError: import_string() failed for 'core'. Possible reasons are:

- missing __init__.py in a package;
- package or module path not included in sys.path;
- duplicated package or module name taking precedence in sys.path;
- missing module, class, function or variable;

Debugged import:

- 'core' not found.

Original exception:

ImportError: cannot import name ColumnForm
jstacoder commented 10 years ago

Ahhhh i know whats up, not sure why it works here and not there, but

core (the blueprint object) isnt needed in the view file, thats why the

urls.py file is there, to tie them together without circular imports.

ill remove the import and recommit it.

On 10/25/2014 11:36 PM, ondoheer wrote:

I tried that too before opening the issue,

can it be it's doing a circular import?

since views is importing core and core is importing views?

|File "/var/www/flask-cms/flask_cms/core/init.py", line 12, in

 from views import *

File "/var/www/flask-cms/flask_cms/core/views.py", line 13, in

 from .forms import MarkdownEditor,ColumnForm

werkzeug.utils.ImportStringError: import_string() failed for 'core'. Possible reasons are:

  • missing init.py in a package;
  • package or module path not included in sys.path;
  • duplicated package or module name taking precedence in sys.path;
  • missing module, class, function or variable;

Debugged import:

  • 'core' not found.

Original exception:

ImportError: cannot import name ColumnForm

Reply to this email directly or view it on GitHub

https://github.com/jstacoder/flask-cms/issues/3#issuecomment-60508115.

jstacoder commented 10 years ago

ok b1cc81b should get past that

jstacoder commented 10 years ago

oh crap, i just looked at your last stack trace

jstacoder commented 10 years ago

ok your last error was caused by an import i added for a form that i never implemented, i hate when i get ahead of myself like that, 426d1b1 should fix that error

jstacoder commented 10 years ago

ok this time i mean it, i actually did implement the form and that view file needs to import it, so 1558353 fixs this issue once and for all

ondoheer commented 10 years ago

Brilliant! It works now!

jstacoder commented 10 years ago

cool, right now it's got a lot of functionality but it's kind of buried away In the URL structure. To get a quick idea of the urls you can check out (without having to read all the urls.py files) just run:

Python manage.py show_urls

The /about endpoint has an add page form I modeled after django's, and the /meet-us and /contact endpoints have decent default to. There's a ton of stuff there have fun checking it out.

Thank You, Kyle Roux | Level 2 Designs Inc. | Developer


(P: 714-888-4557tel:714-888-4557 xtn. 307) (F: 714-455-2115tel:714-455-2115) Email: kyle@Level2Designs.commailto:kyle@level2designs.com 1045 W. Katella Ave.x-apple-data-detectors://5/3 Suitex-apple-data-detectors://5/3 #350 Orange, CA 92867 For emergency support, please call: 714-888-4557tel:714-888-4557 xtn. 2 or email: support@level2designs.commailto:support@level2designs.com CONFIDENTIALITY NOTE:The information contained in this transmission is for business purposes and is privileged and confidential information intended only for the use of the individual or entity named above. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this transmission in error, please return to the sender and delete it.

On Oct 26, 2014, at 8:43 PM, "ondoheer" notifications@github.com<mailto:notifications@github.com> wrote:

Brilliant! It works now!

— Reply to this email directly or view it on GitHubhttps://github.com/jstacoder/flask-cms/issues/3#issuecomment-60547533.