Fantomas42 / django-blog-zinnia

Simple yet powerful and really extendable application for managing a blog within your Django Web site.
http://django-blog-zinnia.com/
BSD 3-Clause "New" or "Revised" License
2.11k stars 730 forks source link

No module named parse at urllib.parse - python 2.7 problem #550

Closed fabiomolinar closed 4 years ago

fabiomolinar commented 5 years ago

Actual behavior

When running python manage.py migrate or python manage.py runserver, the script stops at an ImportError error.

Expected behavior

To be able to run my migrations and the server.

Steps to reproduce the issue

I am trying to install Zinnia on a quite fresh Django website which contains basically just an index.html page and a template.

Steps

  1. pip install django-blog-zinnia
  2. Updated INSTALLED_APPS with 'django.contrib.sites', 'django_comments', 'mptt', 'tagging', and 'zinnia'
  3. Added the context processors 'zinnia.context_processors.version'
  4. Added the following url patterns to my project urls.py: url(r'^weblog/', include('zinnia.urls')) and url(r'^comments/', include('django_comments.urls')),
  5. Added SITE_ID = 1 to my project's settings.py

Specifications

Package Version
beautifulsoup4 4.6.3
Django 1.11.16
django-blog-zinnia 0.20
django-contrib-comments 1.9.0
django-js-asset 1.1.0
django-mptt 0.9.1
django-tagging 0.4.6
django-xmlrpc 0.1.8
mots-vides 2015.5.11
Pillow 5.3.0
pip 18.1
psycopg2 2.7.6.1
pyparsing 2.3.0
pytz 2018.7
regex 2018.11.7
setuptools 40.5.0
wheel 0.32.2

Python is 2.7 and I am running my server on a Linux Mint Mate (Tara)

Discussion

Seems some pieces of the code don't support Python2. I wonder if something like this would fix it:

At ping.py

try:
    from urllib.parse import urlsplit
except ImportError:
     from urlparse import urlsplit

But I don't know if overall this package is meant to run with Python3 only.

Disclaimer

Before submitting an issue make sure you have:

fabiomolinar commented 5 years ago

I tried the solution I described under the Discussion topic of the ticket above, but it seems to exist many imports which are Python3 only in the package.

fabiomolinar commented 5 years ago

3to2 tool

If somebody gets here with the same problem, I used a tool called 3to2 in order to try to convert the code to Python 2. I haven't tested anything yet, but as far as running the migrations, the server and getting the standard Zinnia blog running, it worked.

steps

First of all, don't forget to create a backup copy of Zinnia.

  1. Create a new Python3 environment (I keep my virtual environments within ~/env) . cd ~/env . virtualenv python3 --python=python3.6
  2. Activate the environment . source python3/bin/activate
  3. Install 3to2 . pip install 3to2
  4. Run the tool . 3to2 path/to/Zinnia -w

It seems to be working for me for now. I will try it further and make some tests to see how it goes.

If there is another official way to run Zinnia with Python 2, please let me know!

Fantomas42 commented 4 years ago

Version 0.20 is not compatible with release of Django.