Hi and greetings! I am new to python and django. I am not able to register my model with the admin site. I tried to play around and search the issue on the forums but couldnt. i think the issue is i am unable to import 'myapp' please help Error
Traceback (most recent call last):
File "/home/abhijitshingote/mysite/myapp/admin.py", line 2, in <module>
from myapp.models import Topic
ImportError: No module named 'myapp
settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mysite.myapp'
]
wsgi.py
import os
import sys
path = '/home/abhijitshingote/mysite'
if path not in sys.path:
sys.path.append(path)
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
application = get_wsgi_application()
models.py
from __future__ import unicode_literals
from django.db import models
class Topic(models.Model):
text=models.CharField(max_length=200)
def __str__(self):
return self.text
admin.py
from django.contrib import admin
from myapp.models import Topic
admin.site.register(Topic)