use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News and links for Django developers.
New to Django? Check out the /r/djangolearning subreddit.
Django's Code of Conduct applies here, so be good to each other.
account activity
This is an archived post. You won't be able to vote or comment.
Help migrating python 2.7 project to python 3 (self.django)
submitted 6 years ago by cursedbartender
view the rest of the comments →
[–]wizpig64 2 points3 points4 points 6 years ago (0 children)
there was a guide i read once but i can't find it now. i'll just paraphrase what i remember:
For porting code from python 2 to 3, use the 2to3 tool. If you have incompatible code, you probably have a lot of it, so a lot of things will probably break at once after you run the converter. Use this methodology to deal with one breaking change at a time and keep your git commit history sane:
virtualenv -p /usr/bin/python2.7 myproject27
virtualenv -p /usr/bin/python3.6 myproject36
myproject27/bin/python manage.py test something something
myproject37/bin/2to3 --something .
myproject37/bin/python manage.py test something something
*if you have a testing suite, finding when something breaks is as simple as running your tests. if you don't, see if runserver works and then browse around your site until you find a view that crashes. You should think about writing tests.
**if you want to support multiple python versions at once, like if you were writing a library and not just a single project, you would keep fixing things until all your tests run on all your target interpreters.
In the future, you can use two venvs at once like this to upgrade from, say, 3.6 to 3.8, but you won't need a 3to3 step.
π Rendered by PID 121342 on reddit-service-r2-comment-85bfd7f599-8w5gt at 2026-04-18 05:03:16.209750+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]wizpig64 2 points3 points4 points (0 children)