guitar-academy / gaserver

Server for Guitar Academy written in Python
0 stars 0 forks source link

Fix an invalid import of application.models.core #7

Closed 9gix closed 9 years ago

9gix commented 9 years ago

because models.core is not a python module.

__init__.py marks a folder being a python module. Thus allowing us to import it.

andhieka commented 9 years ago

No wonder I experienced this error yesterday when deploying to Apache. It's strange, why does application.models have to be a module? We are only importing application.models.core. And the strangest thing is, it works in my computer but not on server.

9gix commented 9 years ago

because you are "importing". import statement will find, load and initialize module, not folder or file

9gix commented 9 years ago

PEP 420 explains why a package without __init__.py is still a Python package.

TL;DR; This feature is only for Python 3.3 onward and known as namespace package.