I recently started looking into django and I started with the tutorial.
I noticed that django-admin.py startproject project_name creates a flat file system structure.
According to the tutorial, the project layout has changed:
The default project layout recently changed. If you're seeing a "flat" layout (with no inner mysite/ directory), you're probably using a version of Django that doesn't match this tutorial version. You'll want to either switch to the older tutorial or the newer Django version.
I checked the version of django by running:
import django
django.get_version()
And I have the latest version 1.3.1
I was wondering if it is possible that I have two copies of django installed?? Or how can I solve this? I want to make sure that I have the latest django running.
I don't understand the confusion.
All 1.3 versions use the old flat layout. The development version - recently tagged as 1.4 alpha - uses the new one. You should be using the documentation that matches your version.
Related
I am learning Django and I saw that you can install it regularly, according to the Django documentation. But I also saw that you can work with it in Anaconda. Is there a difference in developing? Or is it all just the same.
Thanks
Anaconda is a distribution on Python that comes with specific versions of a bunch of libraries so that everything is compatible and ready for data science.
So for Django, it will only give you a specific version of it. If you intend to use Anaconda as a framework to do data science, it might be worth it. If you just need Django, just install Django standalone.
I created a plugin with a field in models:
picture = FilerImageField(related_name="gallery_image")
Now, when I try to add the plugin to a placeholder, window opens when I can add a picture. So I click "Add file" and new page opens with a list of uploaded files (empty right now). On that page I click create catalogue, enter it's name and when I click save the error shows up:
AttributeError at /pl/admin/filer/folder/make_folder/
'Folder' object has no attribute 'get_deferred_fields'
Django 1.7.9
Thank you for any help
AttributeError at /pl/admin/filer/folder/make_folder/
'Folder' object has no attribute 'get_deferred_fields'
The reason for this is a mismatch between Django 1.7 and the django-mptt version. Django 1.8 introduced get_deferred_fields, and django-mptt-0.8.0 dropped support for Django < 1.8.
If you are running Django < 1.8, the last supported version for django-mptt is 0.7.4.
pip install django-mptt==0.7.4
Caution: Since Django 1.7 is not officially supported any longer, the safest option of course is to upgrade to Django 1.8 (LTS).
I had this issue, where it was not working on my test environment and it worked correctly on my local environment.
A few things that were not in sync. One of them was the django-mptt. In my test it was 0.8.7 and in my local I had it as 0.6.1. To test it out I updated my local, which upgrade my django to 1.9, which broke everything. So I reverted Django to 1.7.9 and mptt to 0.6.1. Also I updated my Pillow to 3.1.1.
So basically it is a combination if installing the plug in and making sure your requirements file has the right versions.
I got the same error when using d the library django-mptt. Then I upgraded from django 1.7.11 to 1.8.11 and worked very well.
I am having a problem getting the Django registration module to work. I am relatively new to Django, having only worked through a few examples, now wanting to rebuild a site using user registration, that I've previously made with python.
I am using Python 2.7, Django 1.7.1, and my operating system is Ubuntu 14.04. I'm also using Eclipse/PyDev for my IDE.
I keep getting the error message:
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.
I have installed both the django-registration and django-registration-redux modules, understanding that there may issues with installing django-registration in Django 1.7. Should I copy the registration module directly into my app, although not advised, but for troubleshooting? Should I uninstall something before I install a new package?
The django-registration module resides in "/usr/local/lib/python2.7/dist-packages." I'm not sure where the django-registration-redux module should have ended up at, although it deposited "django_registration_redux-1.1.egg-info" with the dist-packages.
I have added 'registration', to the settings file, and to my urls' file pattern I've added: (r'^accounts/', include('registration.backends.default.urls')),
I've read numerous on-line postings about this issue, but I can't get around this block. Should I uninstall Django 1.7.1, and install Django 1.6 to avoid this impasse?
Thanks,
Walter Goedecke
Have you considered using django-allauth instead of django-registration?
As I understand it, django-registration is no longer being maintained.
Were you able to resolve this?
When you say “I have installed both the django-registration and django-registration-redux modules”, do you mean you are trying to use both at the same time, or you tried one and then the other? You should only be using django-registration-redux, I believe django-registration stopped being maintained during one of the Django 1.6 releases, maybe it was 1.5 don’t recall. If its of any help, we have Django 1.7.9, Django 1.8.1, and Django 1.8.3 working with django-registration-redux 1.1.
It sounds like you are installing your python packages system wide (you said its residing in /usr/local/lib/python2.7/dist-packages). There is a great tool called virtualenv that lets you keep all of your projects isolated, in their own virtual environment with their unique dependences. This way one project can be using django 1.5 while another is using django 1.7, one project can use django-registration-redux while the other uses allauth, etc. The other great thing about it, is that it makes your projects more portable, easier to share, and easier to update.
If you haven’t tried it yet, you should check it out!
http://docs.python-guide.org/en/latest/dev/virtualenvs/
I found this link very helpful when I was first getting started with Python and Django development:
http://www.jeffknupp.com/blog/2013/12/18/starting-a-django-16-project-the-right-way/
I have a django project version 1.4 Is it possible to upgrade it to higher version so that it still works. Should I start the project again from scratch. Is so what are the steps? Is the a proper documentation of django for deployment of the project in windows.
You're right, the django migration is something not very documented.
In my opinion, the best thing you can do to be quick and secure, is:
Check all the major changes between Django 1.4 and 1.7 (look for changelog and Djang website).
Take a look to your code to be aware of what part will be obsolete after the migration.
Do the migration, in a non-critic environment of course. For this purpose, don't touch to your code first, just upgrade the Django version
Fix your code until it works perfectly (run unit tests if you have some).
You're ready to do the migration in a production environment.
I did it between Django 1.6 and Django 1.7 (and migrating from Python 2.x to 3.x in the same time). It was easier than I had imagined. However, Django 1.4 to 1.7 could be a little bit longer, but nothing hard.
As specified in the tutorial (http://www.jython.org/jythonbook/en/1.0/JythonDjango.html), I am using doj.backends.zxjdbc.postgresql as Django's DB engine. However, when I do
jython manage.py syncdb
I get an ImproperlyConfigured error, stating that doj.backends.zxjdbc.postgresql is not an available backend and that no module named postgresql exists. Strangely, if I enter the Jython shell, I can do
import doj.backends.zxjdbc.postgresql
without any error messages.
Ideas on what is going on here?
Solution: django-jython is out of date. 1.4 is not currently supported, so there is no solution to this issue other than to revert to a supported version of django.
Unfortunately it seems like django-jython is not seeing much/any active development anymore...
However, I have found that development versions available at the Google code repository below do work in Django 1.5 (and I assume they may work with 1.4 too, if you pick the right version):
https://code.google.com/p/django-jython/source/list
In particular, I have found that this dev version works with Django 1.5:
https://code.google.com/p/django-jython/source/detail?r=c4a0dd949a6d86a4baf8d1bed3b1926fa5318e87