I have created a new virtual environment so that I can update my code from django1.3 to django1.4. The django1.3 environment has no issues with the sqlite version and database I am using. The Django1.4 version gives me a error of:
DISTINCT ON fields is not supported by this database backend
I am not finding any information on changes to the new version that might cause this. Does anyone know why it might work fine in 1.3 and not 1.4?
Related
I tried to connect to Sybase database from Django using sqlanydjango, but
I have stuck. One answer saying that
sqlany-django is no longer maintained; it was last updated in May 2016.
What is the other possibility to connect to Sybase database?
OS Ubuntu 18.04
django 2.2.4
Sybase is no longer maintained and it's not supported by Django. I recommend using one of the supported databases:
PostgreSQL
MariaDB
MySQL
Oracle
SQLite
Personally, I would recommend using PostgreSQL - I think it's the most advanced database. If you use it, I would recommend using version 13, since version 14 is still new and I think it's not officially supported by Django yet. It's always a good practice to use the previous major release. Also with Django, I recommend upgrading to the latest major release only about 4 to 6 months after its initial release. So for today, this means using Django 3.2 (latest minor release, currently 3.2.11).
You can use django-environ to define the database you are using in settings.
You could use the freetds module. GitHub repository was active 5 days ago, it aims to provide support for sybase and MSQL Server.
I used it with MSQL
You can download it from there, and installing with the instruction on this link (Sybase python module website)
Then you can test your installation using these steps
You can also try different Django version.
If this doesn't show anything wrong, and Django still won't connect to your DB, you can try to edit Django's source files so the ImproperlyConfigured exception doesn't raise (REALLY REALLY RISKY, DO A BACK UP OF YOUR DB) or migrate your Sybase to a supported database.
You can use pyodbc.
To install this.
Pip install pyodbc
import pyodbc
cnxn = pyodbc.connect(‘DRIVER={Devart ODBC Driver for ASE};Server=myserver;Port=myport;Database=mydatabase;User ID=myuserid;Password=mypassword;String Types=Unicode’)
For reference:-
https://medium.com/#sharma.jayant1992/best-way-to-connect-python-with-sybase-database-76445713efaf
I was working on a Django project in version 2.0, but my client was unhappy about it as he wants that project to be made with Django 1.1.3. So, I switched back to old version and tried to setup the project on that version but was unable to do so.
After that, I created a new project in Django 1.1.3 and created a Django app too. I tried to run command python manage.py syncdb but I got this error message:
Error: No module named messages
What's the issue? I am not able to find Django 1.1.3 documentation on this.
The module django.contrib.messages is available only for Django versions >= 1.2, unfortunately.
You could maybe convince your client to switch to 1.2.X, or write your own messages as part of your server's responses, and create your own client-side message renderer.
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.
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
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.