Я полный новичок в python/coding/webdevelopment и запутываюсь в процессе развертывания.развертывание приложения django для heroku
Я закодировал приложение для знакомств, используя Python/django. Я пытаюсь развернуть это приложение с помощью Heroku. Я следил за всеми направлениями в настройке сервера, инициализацией git repo, созданным профилем, gunicorn и т. Д. И т. Д. И т. Д. И т. Д.
Я был в состоянии git push heroku master.
Однако, когда я на самом деле пытаюсь синхронизировать свои файлы в базе данных, он меня затягивает.
Я напечатал это: Heroku запустить питон manage.py совершают миграции
Я получаю следующее сообщение об ошибке:
Running python manage.py migrate on ⬢ blooming-island-78995... up, run.1306
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 327, in execute
django.setup()
File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/app/.heroku/python/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/app/directmessages/models.py", line 9, in <module>
user_obj = User.objects.get(username='ayaspencer')
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/manager.py", line 122, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 381, in get
num = len(clone)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 240, in __len__
self._fetch_all()
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 1074, in _fetch_all
self._result_cache = list(self.iterator())
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 52, in __iter__
results = compiler.execute_sql()
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 848, in execute_sql
cursor.execute(sql, params)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/utils.py", line 95, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "auth_user" does not exist
LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user...
^
что это значит по AUTH_USER не существует? Означает ли это, что мне нужно создать суперпользователя? Я попробовал, и это не позволит мне. Когда я делаю heroku, запускаю python manage.py createuperuser, он дает мне ту же самую ошибку.
Пожалуйста, помогите мне !!! Пожалуйста, направляйте меня по правильному пути.
вот мой models.py для проводки приложение
from django.db import models
from django.contrib.auth.signals import user_logged_in
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
def upload_location(instance, filename):
#extension = filename.split(".")[1]
location = str(instance.user.username)
return "%s/%s" %(location, filename)
class PostingMessageManager(models.Manager):
def get_num_unread_messages(self, user):
return super(PostingMessageManager, self).filter(read=False).count()
class PostMessage(models.Model):
subject = models.CharField(max_length=150)
body = models.CharField(max_length=3000)
service_being_requested = models.CharField(max_length=3000, null=True)
service_being_offered = models.CharField(max_length=3000, null=True)
sender = models.ForeignKey(User, related_name='sent_post_messages', null=True, blank=True)
receiver = models.ForeignKey(User, related_name='received_post_messages', null=True, blank=True)
sent = models.DateTimeField(auto_now_add=False, auto_now=False, null=True, blank=True)
read_at = models.DateTimeField(auto_now_add=False, auto_now=False, null=True, blank=True)
read = models.BooleanField(default=False)
parent = models.ForeignKey('self', related_name='parent_message', null=True, blank=True)
replied = models.BooleanField(default=False)
CERTIFIED = 'Yes'
NONCERTIFIED = 'No'
INDIFFERENT = 'Indifferent'
CERTIFICATION_CHOICES = (
(CERTIFIED, 'Yes'),
(INDIFFERENT,'Indifferent'),
)
CERTIFICATION_CHOICES_ME = (
(CERTIFIED, 'Yes'),
(NONCERTIFIED, 'No'),
)
should_they_be_certified = models.CharField(max_length=200,
choices=CERTIFICATION_CHOICES,
default=INDIFFERENT)
are_you_certified = models.CharField(max_length=200,
choices=CERTIFICATION_CHOICES_ME,
default=NONCERTIFIED)
def is_certified(self):
return self.should_they_be_certified in (self.CERTIFIED)
def dont_care(self):
return self.are_you_certified in (self.INDIFFERENT)
def iam_certified(self):
return self.are_you_certified in (self.CERTIFIED)
def __unicode__(self):
return self.body
objects = PostingMessageManager()
def get_absolute_url(self):
return (reverse('view_post_message', kwargs={'ps_id': self.id}))
class Meta:
ordering = ['-sent',]
def set_messages_in_session(sender, user, request, **kwargs):
post_message = PostMessage.objects.get_num_unread_messages(user)
request.session['post_num_of_messages'] = post_message
user_logged_in.connect(set_messages_in_session)
#class F(models.Model):
#certification = models.CharField(max_length=50, choices=CERTCHOICE)
#class Meta:
#model = PostMessage
#fields = ['certification']
также, не уверен, если это будет какой-либо помощи, но я сделал поиск clean_username и на основании моих показаний от этого Django custom user model in admin, relation "auth_user" does not exist
python2.7/site-packages/django/contrib/auth/backends.py:
123 return
124 user = None
125: username = self.clean_username(remote_user)
126
127 UserModel = get_user_model()
...
143 return user
144
145: def clean_username(self, username):
146 """
147 Performs any cleaning on the "username" prior to using it to get or
python2.7/site-packages/django/contrib/auth/middleware.py:
78 # persisted in the session and we don't need to continue.
79 if request.user.is_authenticated():
80: if request.user.get_username() == self.clean_username(username, request):
81 return
82 else:
..
94 auth.login(request, user)
95
96: def clean_username(self, username, request):
97 """
98 Allows the backend to clean the username, if the backend defines a
99: clean_username method.
100 """
101 backend_str = request.session[auth.BACKEND_SESSION_KEY]
102 backend = auth.load_backend(backend_str)
103 try:
104: username = backend.clean_username(username)
105: except AttributeError: # Backend has no clean_username method.
106 pass
107 return username
7 матчей через 2 файлов
'python manage.py migrate' –
Я тоже это пробовал. Я получил ту же самую ошибку :(:( – pynewbee
Пожалуйста, добавьте ваш 'postings/models.py' на ваш вопрос! –