Raulsc
Raulsc

Reputation: 75

Django on APP Engine - error redirecting a URL path to an existing function in views.py (on urls.py)

I'm getting an error when I try to redirect a URL path to an existing function inside of a views.py file.

I realize where the problem is, but I cannot figure out how to solve it.

I have the following structure of folders on my project:

my_app_gae
  app.yaml
  main.py
  settings.py
  urls.py
  my_app_django (<-- here is my django project)
    dashboard
      views.py
    models
      models.py

The problem comes here:

when I edit the urls.py file, when I try to redirect a specific URL path to an existing function inside of views.py (landing), I recieve the following error:

Request Method: GET
Request URL:    http://localhost:8090/landing/
Exception Type: ImportError
Exception Value:    No module named my_app_django

The value of my Python Path is: V:\Python~1\my_app_gae (the place where the structure of folders I wrote before is).

The url.py value that I'm trying to execute is:

from django.conf.urls.defaults import *
from my_app_django.dashboard.views import landing

urlpatterns = patterns(
    '',
    (r'^landing/$', landing),
)

If I copy the views.py file directly on the my_app_gae directory it works. The problem comes when the views.py file is inside of other directories.

Thanks a lot.

Regards

Upvotes: 0

Views: 63

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599788

To be recognized as a Python package, you need empty files named __init__.py in each subdirectory.

Upvotes: 2

Related Questions