We are just starting some cloud-based apps based on Python + Django and we have a small dilemma. At first we decided to go with Python 3.3, but than we saw that a lot of libraries/modules have not been ported yet, thus we might have to do extra work to make sure that everything works with Python 3.3.
Given the fact that the projects that we are starting will have a time frame of a few years what advice would you give us? To go with Python 2.7 or Python 3.3?
Thanks in advance!
Go with Python 2.7 for now. Make sure that your code translates cleanly when using 2to3. When the modules are available for Python 3.x, translate your code and run with it.
Related
Disclaimer:
First, I apologise if I'm incorrectly applying technical terms here or, worse, completely misunderstanding things. I'll edit if corrected.
Context:
Lately I've been building and deploying some basic website ideas to Heroku using the Django framework. I've been doing this on Windows, using venv as my virtual environment "wrapper". I've been building these exclusively from the command line interface.
I also have a MacBook that I'd like to use to access and manage those websites, and in future, larger projects. I would prefer not to install Windows on this MacBook.
To be clear, I know that it's possible to build and deploy a website using Django and Heroku on macOS. I know there are, at the very least, some syntactical differences in how I would approach this from the CLI versus Terminal.
Desired outcome:
I would like to set up a website in the fashion indicated above on Windows or macOS, and then access and manipulate it from the other OS.
Questions:
Is this possible? (Or if I set it up on Windows must I only use Windows to manage it?)
If I set up a website in this fashion using Django, Heroku, and venv on Windows, how (if at all) might I then access and manipulate that website from macOS? I think what I'm mostly stuck on is that, as far as I can tell, I can't use the same virtual environment on both Windows and macOS (I believe venv is itself Windows-only).
Is it possible to "wrap" my website in both venv (Windows) and virtualenv (macOS)?
Am I correct in thinking the only real (i.e. non-syntactical) difference that I need to account for is the virtual environment itself?
--
Sorry if I have massive gaps in my knowledge. I'm self-taught and have historically been terrible at asking for help. I'm trying to fill the gaps by improving my question-asking.
Finally, I suspect that the fact I'm using Heroku may be irrelevant, but I'm including that information in case I am mistaken.
Yes, for most of the projects, you will be able to develop your Django web site on Windows, MacOS and Linux simultaneously. Your virtual environment "wrapper" doesn't really matter, you will use or install and use the one you like or available on your OS.
Then you will learn about Docker.
I'm kind new on programming and I have this book ThinkPython 2012 which I'm planning to finish, I'm on chapter 4 and it requires me to download this package http://thinkpython.com/swampy. It would be easy if I just use the normal python however I am using enthought canopy. Is it possible to get that package into the canopy? I'm using windows 7 64-bit but I'm using a 32-bit canopy.
Should be straightforward. See these two articles on the Enthought support site:
https://support.enthought.com/entries/23389761-Installing-packages-into-Canopy-User-Python-from-the-OS-command-line
https://support.enthought.com/entries/21793229-Using-Tkinter-Turtle-in-Canopy-s-IPython-panel
How would one set up python 2.7 and python 3.x on the same computer. Most of my old code is in 2, but a platform I am trying to use uses 3. How do I setup an enviroment in which I can work on both easily. I am using Ubuntu 13.10 by the way, so no Windows exclusives.
You pretty much said it in your question. You need to setup an environment, a virtualenv to be precise. Check this answer: https://stackoverflow.com/a/1534343/276451 it's exactly what you're looking for.
I finally want to migrate a Django project to Python 3.3 but have some issues with django-compressor, because it is not Python 3 compatible (yet).
Out of the asset managers listed on https://www.djangopackages.com/grids/g/asset-managers/ these seem interesting to me, since they support CSS/LESS too:
https://www.djangopackages.com/packages/p/webassets/
https://www.djangopackages.com/packages/p/django-pipeline/
https://www.djangopackages.com/packages/p/django-gears/
I have multiple CSS and LESS files, and a lot of JavaScript files which need to be minified, and Python 3.3 must be supported. What would you recommend for my use case? Are there other, better suited projects around?
I recommend to use a django-pipeline. It supports python 3 and do what it should do. I used it for one of my project ( but it was python 2.7) and perfectly happy with it.
I heard about lots of compatibility issues with PostgreSQL and Django + psycopg2.
What would be the recommended latest and greatest versions that are fully compatible for a new Django project starting from scratch?
The bug is not critical: it only affects database creation during tests: https://code.djangoproject.com/ticket/16250 There should be no other problem between psycopg and django.
The problem can be avoided using psycopg 2.4.1, but there have been several bug fixes since then, so I'd rather apply some simple patch to django to make the two play well together.
BTW I wonder when will they release django 1.3.2: the bug is been there for 6 months now...