I am trying to convert a wordpress blog to be able to set up a website
on top of byteflow.
While I did not realy understood how to use the Wpimport [tried to
use directly the WP database, set ENABLE_IMPORT enabled the wpimport
app] I decide to use directly the WXRImporter.py obtaining the results
here below.
Thanks in advance for any clue.
In [1]: import getopt, sys
In [2]: import random
In [3]: import xml.dom.minidom
In [4]: import logging
In [5]: from datetime import datetime, tzinfo, timedelta
In [6]:
In [7]: from django.core.management import setup_environ
In [8]: import settings
!!! Read about DEBUG in settings_local.py and then remove me !!!
In [9]: setup_environ(settings)
Out[9]: '/opt/django/martaportal'
In [10]:
In [11]: from apps.discussion.models import CommentNode
!!! Read about DEBUG in settings_local.py and then remove me !!!
In [12]: from django.contrib.contenttypes.models import ContentType
In [13]: from django.core.exceptions import ObjectDoesNotExist
In [14]: from django.contrib.auth.models import User
In [15]: from apps.blog.models import Post
---------------------------------------------------------------------------
AttributeError Traceback (most recent call
last)
/opt/django/martaportal/<ipython console> in <module>()
/opt/django/martaportal/apps/blog/models.py in <module>()
121 r = (datetime.combine(d, time.min), datetime.combine(d,
time.max))
122 return Post.objects.filter(date__range=r).get(slug=slug)
--> 123 register_pingback('blog.views.post_detail',
pingback_blog_handler)
124
125 ping_links = ping_external_links(content_attr='html',
/opt/django/martaportal/apps/pingback/__init__.pyc in
register_pingback(view, pingback_func)
34 if isinstance(view, basestring):
35 mod, view = view.rsplit('.', 1)
---> 36 mod = __import__(mod, {}, {}, [view])
37 view = getattr(mod, view)
38 view.pingback = pingback_func
/opt/django/martaportal/apps/blog/views.pyc in <module>()
22 from discussion.forms import CommentForm, AnonymousCommentForm
23 from discussion.models import CommentNode
---> 24 from blog.models import Post
25 from tagging.views import tagged_object_list
26 from render import render
/opt/django/martaportal/apps/blog/models.py in <module>()
121 r = (datetime.combine(d, time.min), datetime.combine(d,
time.max))
122 return Post.objects.filter(date__range=r).get(slug=slug)
--> 123 register_pingback('blog.views.post_detail',
pingback_blog_handler)
124
125 ping_links = ping_external_links(content_attr='html',
/opt/django/martaportal/apps/pingback/__init__.pyc in
register_pingback(view, pingback_func)
35 mod, view = view.rsplit('.', 1)
36 mod = __import__(mod, {}, {}, [view])
---> 37 view = getattr(mod, view)
38 view.pingback = pingback_func
39
AttributeError: 'module' object has no attribute 'post_detail'
It appears that the `django.core.management.setup_environ(settings)`
doesn't actually setup the environment.
I've had some luck faking it out by doing the following:
$ python manage.py shell
(InteractiveConsole)
>>> import sys; sys.argv = ["WXRImporter.py", "--input=wordpress.2010-03-29.xml"]
>>> import WXRImporter; WXRImporter.main()
However, now it's failing on the `post.save` call in `process_item`
with the following:
IntegrityError: (1048, "Column 'site_id' cannot be null")
If anyone else has any ideas, please send some advice!
Thanks
- Mike
> $ python manage.py shell
> (InteractiveConsole)
>>>> import sys; sys.argv = ["WXRImporter.py", "--input=wordpress.2010-03-29.xml"]
>>>> import WXRImporter; WXRImporter.main()
> However, now it's failing on the `post.save` call in `process_item`
> with the following:
> IntegrityError: (1048, "Column 'site_id' cannot be null")
You need to edit wxrimporter to add site_id to every post. It should be
your main site id, probably the only you have in database.
--
Alexander