Python 数据库一直恢复到以前的日期

Python 数据库一直恢复到以前的日期,python,django,heroku,Python,Django,Heroku,所以,我写这篇文章是带着一个警告,我很清楚你会问更多的信息,但我还不知道该说什么 我有一个django应用程序为个人网站提供动力,它有一个简单的留言板,让人们给我留言,告诉我我有多棒。现在,我在这个应用程序中遇到了很多麻烦,并且来回地经历了很多git问题,我猜这可能是导致这个问题的原因 不知何故,我的数据不断被替换为数据库的特定快照。当我今天早上检查它时,它有十条旧的虚拟测试消息,还有一条新的真实消息。我回复了新的真实版本,删除了虚拟测试版本,一切看起来都很好。我今天没有再碰这个应用程序。当我刚

所以,我写这篇文章是带着一个警告,我很清楚你会问更多的信息,但我还不知道该说什么

我有一个django应用程序为个人网站提供动力,它有一个简单的留言板,让人们给我留言,告诉我我有多棒。现在,我在这个应用程序中遇到了很多麻烦,并且来回地经历了很多git问题,我猜这可能是导致这个问题的原因

不知何故,我的数据不断被替换为数据库的特定快照。当我今天早上检查它时,它有十条旧的虚拟测试消息,还有一条新的真实消息。我回复了新的真实版本,删除了虚拟测试版本,一切看起来都很好。我今天没有再碰这个应用程序。当我刚才再次去查看时,新的消息不见了,虚拟的消息又回来了

它是通过Heroku部署的,用Python 2.7和Django 1.6编写。该网站位于www.wienerwidding.com/guestbook/上

这是我的settings.py文件,这是我唯一能猜测的问题。 如果你告诉我什么可能有帮助,我会包括在内

# Django settings for wedding project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    ('xxx', 'xxxx@gmail.com'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {

        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'wedding.db',


    }
}
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']

    # Parse database configuration from $DATABASE_URL
if(DEBUG != True):
    import dj_database_url
    DATABASES['default'] =  dj_database_url.config()

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')


TIME_ZONE = 'America/New_York'

LANGUAGE_CODE = 'en-us'

SITE_ID = 1

USE_I18N = True

USE_L10N = True

USE_TZ = True


MEDIA_ROOT = '/Users/paulnichols/code/wedding/mainsite/static/images/photoalbum/'

MEDIA_URL = 'http://127.0.0.1:8000/photos/'

import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'mainsite/static/'
STATIC_URL = '/static/'

STATICFILES_DIRS = (
       os.path.join(BASE_DIR, 'staticfiles'),
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'xxxxxxxx'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django_user_agents.middleware.UserAgentMiddleware',
)

ROOT_URLCONF = 'wedding.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'wedding.wsgi.application'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    'mainsite/templates',
    'quiz/templates',
    'photoalbum/templates',
)

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    'django.contrib.admindocs',
    'mainsite',
    'quiz',
    'photoalbum',
    'django_google_maps',
    'django_user_agents',
    'south',
)

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}

您已将DEBUG设置为True,根据该代码,这意味着您将始终使用可能随应用程序一起上载的sqlite db文件,而不是Heroku的Postgres设置。请确保DEBUG为false,和/或使用另一个环境变量来确定是否使用开发数据库。

git是否正在跟踪widding.db文件?如果是这样,您可能希望停止跟踪它。