Opened 2 years ago

Closed 2 years ago

#20191 closed Uncategorized (invalid)

No Module Named App Name

Reported by: johnsonshara@… Owned by: nobody
Component: Python 2 Version: 1.5
Severity: Normal Keywords:
Cc: bmispelon@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have Created the Project and App using Python And Django.
This is My Model in my model.py


class Poll(models.Model):

question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')


Now When run import Poll though python shell , it gives no module name Poll.

Project Structure :
mysite [project name]

manage.py
mysite

files under mysite

polls [my app]

init
models
views
tests

Change History (1)

comment:1 Changed 2 years ago by bmispelon

  • Cc bmispelon@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Hi,

This site is for reporting bugs against django. For support, you should try the django-users mailing list or the #django channel on IRC: https://docs.djangoproject.com/en/1.5/faq/help/

As for your issue, you're not importing the right module.

In python, the module's name if the name of the file, so you shouldn't be importing Poll.

Rather, you should do from polls.models import Poll, as described in the tutorial: https://docs.djangoproject.com/en/1.5/intro/tutorial01/#playing-with-the-api

Note: See TracTickets for help on using tickets.
Back to Top