can not import the custome apps in django 1.6
Question: i am creating a simple project to test the environment, the project structrue
look like the following

    
    
    root/
        manage.py
        mysite/
            apps/
                __init__.py
                app1/
                    urls.py
                    views.py
            settings.py
            urls.py
            __init__.py
    

in the settings.py file, i install app1 in the INSTALLED_APPS, when i try to
modify the root urls.py by

    
    
    url(r'^app1/', include('apps.app1.urls')),
    

i got the following error

    
    
    Traceback (most recent call last):
      File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 339, in         urlconf_module
        return self._urlconf_module
    AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "D:\Python33\lib\site-packages\django\core\handlers\base.py", line 101, in         get_response
        resolver_match = resolver.resolve(request.path_info)
      File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 318, in resolve
        for pattern in self.url_patterns:
      File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 346, in         url_patterns
        patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
      File "D:\Python33\lib\site-packages\django\core\urlresolvers.py", line 341, in         urlconf_module
        self._urlconf_module = import_module(self.urlconf_name)
      File "D:\Python33\lib\importlib\__init__.py", line 90, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
      File "<frozen importlib._bootstrap>", line 1022, in load_module
      File "<frozen importlib._bootstrap>", line 1003, in load_module
      File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
      File "<frozen importlib._bootstrap>", line 868, in _load_module
      File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
      File "D:/project/worldcup\worldcup\urls.py", line 4, in <module>
        url(r'^app1/', include('apps.app1.urls')),
      File "D:\Python33\lib\site-packages\django\conf\urls\__init__.py", line 26, in include
        urlconf_module = import_module(urlconf_module)
      File "D:\Python33\lib\importlib\__init__.py", line 90, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1512, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1512, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1529, in _find_and_load_unlocked
    ImportError: No module named 'apps'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "D:\Python33\lib\wsgiref\handlers.py", line 137, in run
        self.result = application(self.environ, self.start_response)
      File "D:\Python33\lib\site-packages\django\contrib\staticfiles\handlers.py", line 67, in __call__
        return self.application(environ, start_response)
      File "D:\Python33\lib\site-packages\django\core\handlers\wsgi.py", line 206, in __call__
        response = self.get_response(request)
      File "D:\Python33\lib\site-packages\django\core\handlers\base.py", line 196, in         get_response
        response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
      File "D:\Python33\lib\site-packages\django\core\handlers\base.py", line 231, in         handle_uncaught_exception
        return debug.technical_500_response(request, *exc_info)
      File "D:\Python33\lib\site-packages\django\views\debug.py", line 69, in                 technical_500_response
        html = reporter.get_traceback_html()
      File "D:\Python33\lib\site-packages\django\views\debug.py", line 323, in                 get_traceback_html
        c = Context(self.get_traceback_data())
      File "D:\Python33\lib\site-packages\django\views\debug.py", line 281, in                 get_traceback_data
        frames = self.get_traceback_frames()
      File "D:\Python33\lib\site-packages\django\views\debug.py", line 428, in                 get_traceback_frames
        pre_context_lineno, pre_context, context_line, post_context =                         self._get_lines_from_file(filename, lineno, 7, loader,                 module_name)
      File "D:\Python33\lib\site-packages\django\views\debug.py", line 379, in                 _get_lines_from_file
        source = loader.get_source(module_name)
      File "<frozen importlib._bootstrap>", line 605, in _requires_frozen_wrapper
    ImportError: importlib._bootstrap is not a frozen module
    [08/Dec/2013 22:25:59] "GET /user/hello/ HTTP/1.1" 500 59
    

my develop environment is python 3.3, django 1.6, win 7

can anybody help me out of this trouble, thanks in previous!


Answer: Quick fix modify

    
    
        url(r'^app1/', include('apps.app1.urls')),
    

to

    
    
        url(r'^app1/', include('s20462310mysite.apps.app1.urls')),
    

A better approach would be to change folder structure to:

    
    
    root/
        manage.py
        app1/
            __init__.py
            urls.py
            views.py
        mysite/
            __init__.py
            settings.py
            urls.py
            __init__.py
    

and then use

    
    
        url(r'^app1_new/', include('app1.urls')),
    

in the main urls.py

Other notes:

You don't actually need models.py in an application folder

In Django 1.6 you don't need "**__init_ _**.py" either

But it is a good practice to have those files

