ViewDoesNotExist ... yet it does

I have gotten myself into a problem here and I can't see why. Can anyone help debug this?

I am getting the following error anytime I try to go to any URL:

ViewDoesNotExist at /admin/
Could not import Parent module g001.api does not exist.
Request Method: GET
Request URL:
Django Version: 1.6.6
Exception Type: ViewDoesNotExist
Exception Value:    
Could not import Parent module g001.api does not exist.
Exception Location: /usr/local/lib/python3.4/dist-packages/django/core/ in get_callable, line 104
Python Executable:  /usr/local/bin/uwsgi
Python Version: 3.4.3
Python Path:    

g001 does exist, as do other apps that work fine ( when I comment g001 out of ). The file structure is as follows:

        the other main stuff
    pavachlang/ ( a working app )
        other files
    g001/ ( does not work )
        other files

That's the general structure. I have in both as well. I have template based responses there and JSON based responses in I've used django for small things several times, and the other was working before, so I don't think its an issue that I'm referencing a view function that is not in

From site01/site01/


    # and a few other apps

and from site01/site01/

g001_API = patterns ( 'g001.api',
    url ( r'^data/(?P<slug>[0-9A-Za-z_-])$', 'data' )

and then in the urlpatterns

# other working stuff
# the whole thing works if I exclude this next line by comment
( r'^g001/', include ( g001_API ) ),
( r'^pavachlang/api/', include ( pavachlang_API ) ),
# other working stuff and then the admin urls

There are no major differences between the pavachlang/ and g001 folders. Both have Interestingly, running syncdb works, and I've put data into the MySQL database for the g001.models. I did the models first. was not working, so the tables existing in MySQL but would not show in admin. Then I made a simple view in that echos out some json from the table and when I tried to reference it that is when I got the error.

The only clue I have that something is wrong is that pavachlang/ and the other working apps have a pycache directory magically in them and g001/ does not.

Is there a simple misspelling I am not seeign, and if not how can I narrow in on the problem?

PS, using shell, I can import g001 and its models and its view functions just fine ( as well as from the regular python shell ).

PS2: does have 2 underscores, but markdown is removing them.

PS3: Also, from the shell I can import g001, get its models, play with objects.all () and manipulate adn save them.

PS4: No virtualenv, Django 1.6 with Python3.4.

CLUE: I copied the entire g001 into my ~ home directory using cp -r. Just so I could tinker and have the old folder somewhere. Then my site worked. Which I'm not too happy about, since that means it is using the g001/ folder that is entirely outside of the project directory. The other apps, like pavachlang/, are inside site01/ as siblings of the internal site01/ that has all the urls and settings.

This cannot be how it supposed to work, but it seems to provide some clue? Not sure what clue though.

It can import pavachlang out of site01/, but can't import g001/ out of that same folder, but it can import out of ~

You original error looks like you haven't included the admin app in urls.

__pycache__ is where Python3 stores compiled bytecode. If one directory has a __pycache__ directory and another doesn't, that suggests that the directory without the __pycache__ directory has never had code run it it.

Admin existed before. It was the addition of a new app and corresponding URLs that threw it off.

Something is wrong with my paths, the confusion I am having is that my working and nonworking apps seem structurally identical in every way. I need to understand how the structure is supposed to look I think.

Hi there, did you ever get to the bottom of this? Could it be that there are two different modules called g001 on the path, and it's not importing the one you think it is? A debug print of

import g001

might help...

Hey, thanks. I'm almost positive that was the case. I deleted an old project from my folder that also had a g001 in it ( an older project I abandoned ). I wasn't thinking about it, but just now I moved g001 back into the site01 project and everything still works. I didn't think that old project would have been in my path, but the problem seems to have gone away ( possibly by deleting that other folder).

Am I correct in my folder structure should look?

    proj_name/,, etc.
    app_name1/,,, etc.

I also did some other cleaning up, so if the issue was having a rogue g001 somewhere it got deleted somehow

I found it. I had a sitting in my home directory. I moved it when cleaning up. It was a one-off script I was tinkering with and since it let to an idea for an app so I called the app g001.

Now I understand the error better. g001 did exist but g001.api did not, because it was importing a random file called that had nothing of the sort like "api".

Thanks for the pointer about .file. Learning experience.

Excellent. Glad you worked it out.