我安装了django动态刮刀到我的应用程序,当我推它我的应用程序破了

时间:2016-08-17 00:44:58

标签: python django heroku django-dynamic-scraper

我在我的应用中添加了django动态刮刀。它在本地工作,所以我将它部署到我的heroku服务器,它给我一个500的服务器错误。我的heroku日志中没有错误消息,它在本地工作正常。因为我没有错误,它在本地工作,我不知道什么是顶级帖子,并想知道是否有人可能有同样的问题。这对我来说很疯狂。

修改

我做了一些挖掘工作。我试着

 heroku run python manage.py makemigrations

并得到了这个

Running python manage.py makemigrations on ⬢ heights... up, run.1515
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/commands/makemigrations.py", line 65, in handle
    loader = MigrationLoader(None, ignore_no_migrations=True)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/migrations/loader.py", line 49, in __init__
    self.build_graph()
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/migrations/loader.py", line 306, in build_graph
    _reraise_missing_dependency(migration, parent, e)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/migrations/loader.py", line 276, in _reraise_missing_dependency
    raise exc
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/migrations/loader.py", line 302, in build_graph
    self.graph.add_dependency(migration, key, parent)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/migrations/graph.py", line 126, in add_dependency
    parent
django.db.migrations.exceptions.NodeNotFoundError: Migration blog.0011_auto_20160816_1834 dependencies reference nonexistent parent node ('dynamic_scraper', '0018_auto_20160816_1834')

修改

这是我的0011_auto_20160816_1834.py

# -*- coding: utf-8 -*-
    # Generated by Django 1.9.2 on 2016-08-16 22:34
    from __future__ import unicode_literals

    from django.db import migrations, models
    import django.db.models.deletion


    class Migration(migrations.Migration):

        dependencies = [
            ('dynamic_scraper', '0018_auto_20160816_1834'),
            ('blog', '0010_auto_20160627_1133'),
        ]

        operations = [
            migrations.CreateModel(
                name='NewsWebsite',
                fields=[
                    ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                    ('name', models.CharField(max_length=200)),
                    ('scraper', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dynamic_scraper.Scraper')),
                    ('scraper_runtime', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dynamic_scraper.SchedulerRuntime')),
                ],
            ),
            migrations.AddField(
                model_name='post',
                name='news_website',
                field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='blog.NewsWebsite'),
            ),
        ]

我可以删除

吗?
('dynamic_scraper', '0018_auto_20160816_1834'),

再次运行迁移?我不想完全崩溃我的应用程序。新手程序员,并不完全确定在我的应用程序上这样做的影响。

修改

当我运行show migrations时

(practice) apples-MBP:src ray$ ./manage.py showmigrations
    admin
     [X] 0001_initial
     [X] 0002_logentry_remove_auto_add
    auth
     [X] 0001_initial
     [X] 0002_alter_permission_name_max_length
     [X] 0003_alter_user_email_max_length
     [X] 0004_alter_user_username_opts
     [X] 0005_alter_user_last_login_null
     [X] 0006_require_contenttypes_0002
     [X] 0007_alter_validators_add_error_messages
    blog
     [X] 0001_initial
     [X] 0002_auto_20160404_2019
     [X] 0003_post_image_url
     [X] 0004_auto_20160406_2353
     [X] 0005_image
     [X] 0006_auto_20160603_2317
     [X] 0007_auto_20160603_2326
     [X] 0008_auto_20160625_1708
     [X] 0009_auto_20160627_1034
     [X] 0010_auto_20160627_1133
     [X] 0011_auto_20160816_1834
    contenttypes
     [X] 0001_initial
     [X] 0002_remove_content_type_name
    dynamic_scraper
     [X] 0001_initial
     [X] 0002_scraper_render_javascript
     [X] 0003_auto_20150610_0906
     [X] 0004_scrapedobjattr_id_field
     [X] 0005_new_dict_params_for_scraper
     [X] 0006_request_type_and_body
     [X] 0007_dont_filter_attribute
     [X] 0008_new_request_page_types_construct
     [X] 0009_removed_legacy_request_page_type_scraper_fields
     [X] 0010_move_save_to_db_to_scraped_obj_attr
     [X] 0011_extracted_checker_attributes_to_own_checker_class
     [X] 0012_removed_legacy_checker_scraper_attributes
     [X] 0013_added_scraper_save_and_checker_delete_datetime_fields
     [X] 0014_added_scraper_save_and_checker_delete_alert_period_fields_for_scraper
     [X] 0015_added_datetime_fields_for_last_scraper_save_and_checker_delete_alert
     [X] 0016_optional_xpath_fields_text_type_for_x_path_reg_exp_processor_fields
     [X] 0017_added_order_to_scraped_obj_attr
     [X] 0018_auto_20160816_1834
    sessions
     [X] 0001_initial
    taggit
     [X] 0001_initial
     [X] 0002_auto_20150616_2121

在我的生产服务器上的showmigrations上运行它时编辑

(practice) apples-MBP:src ray$ heroku run python manage.py showmigrations
Running python manage.py showmigrations on ⬢ cheights... up, run.7252
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/commands/showmigrations.py", line 36, in handle
    return self.show_list(connection, options['app_labels'])
  File "/app/.heroku/python/lib/python3.5/site-packages/django/core/management/commands/showmigrations.py", line 44, in show_list
    loader = MigrationLoader(connection, ignore_no_migrations=True)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/migrations/loader.py", line 49, in __init__
    self.build_graph()
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/migrations/loader.py", line 306, in build_graph
    _reraise_missing_dependency(migration, parent, e)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/migrations/loader.py", line 276, in _reraise_missing_dependency
    raise exc
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/migrations/loader.py", line 302, in build_graph
    self.graph.add_dependency(migration, key, parent)
  File "/app/.heroku/python/lib/python3.5/site-packages/django/db/migrations/graph.py", line 126, in add_dependency
    parent
django.db.migrations.exceptions.NodeNotFoundError: Migration blog.0011_auto_20160816_1834 dependencies reference nonexistent parent node ('dynamic_scraper', '0018_auto_20160816_1834')

0 个答案:

没有答案