While upgrading an old project to django 1.8 and djangocms 3.5 I am getting an error that says:
django.db.utils.ProgrammingError: relation "cms_cmsplugin" already
exists
Does anyone understand what is wrong and can help with that?
Thanks.
I have tried some solution propositions on other titles but none worked.
did --fake-initial, tried migrating commenting out all other plugins of cms etc but none worked.
I can only give little advice on your specific error: The table cms_cmsplugin" is already existing. But I guess you can read errors...starting with a fresh db could be a solution (restarting the upgrade process, with the orignal db from before the upgrade). I can give some general advice for upgrading django/django-cms projects.
Key point for me always was: make it reproducable. So you can try things, but also start over again, without much of an effort. I for myself once made a tool for this purpose: project-updater. I normaly had scripts to automatically reset db and media files and git tag to the starting point of my upgrade, then execute steps required up to where I was currently stuck, and from there move on...wether using project updater, your own workflow, or another tool is not of that importance...
Related
when I try to make migrations I am getting the following error:
django.db.utils.OperationalError: table "main_todolist" already exists
This tablet is throwing an error and I dont want to use the table anyways, I am trying to get delete it or at least stop the error. Any suggestions? The more simple the solution the better, I am new to this.
Ive seen that I may need to access the dbshell however I also get the error " You appear not to have the 'sqlite3' program installed or on your path". Ive tried appending \sqlite3 to the end of my path but to be honest I am not really sure how to append the path.
Any help would be great, thank you.
Ive seen that I may need to access the dbshell however I also get the error " You appear not to have the 'sqlite3' program installed or on your path". Ive tried appending \sqlite3 to the end of my path but to be honest I am not really sure how to append the path.
This is because you did not install sqlite3 on your machine, you have to install it from sqlite website, then save it to a directory, and lastly put it in your machine environment path. That way your app can execute it.
django.db.utils.OperationalError: table "main_todolist" already exists.
This tablet is throwing an error and I dont want to use the table anyways, I am trying to get delete it or at least stop the error. Any suggestions? The more simple the solution the better, I am new to this.
For this one if you are just starting the project and has almost no data, I recommend resetting the database following the instruction of this answer https://stackoverflow.com/a/42150639/12581324
The Issue:
It appears there is some sort of encoding/decoding issue going on with flask-bcrypt for my Mac. I'd like to know if there is an easy solution to fix this so I can run my local with a similar setup to my Heroku version.
Comparison:
Local
If I use .decode("utf-8") with generate_password_hash it returns AttributeError: 'str' object has no attribute 'decode'. Without decode, it saves my password to the database properly and I'm able to login with no issues.
When I test bcrypt.generate_password_hash [without decode] in terminal on local it
returns like '$2b$12$yTBsCi.....`
Heroku
If I use .decode("utf-8") with generate_password_hash it saves to the database properly and I"m able to login. If I don't use decode("utf-8"), it saves the password incorrectly (something like: \x243261243132245a4e64696e4d7062327......) and when I try to login it returns ValueError: Invalid salt.
When I test bcrypt.generate_password_hash [without decode] on heroku bash it returns
b'$2b$12$amVQ6f2.d......'
Current Setup:
Both are running Python 3.6.4. Both Heroku and my local version have identical requirements installed. bcrypt==3.1.4 Flask-bcrypt==0.7.1 py-bcrypt==0.4
Documentation:
https://flask-bcrypt.readthedocs.io/en/latest/
In Python 3, you need to use decode(‘utf-8’) on generate_password_hash(), like below:
pw_hash = bcrypt.generate_password_hash(‘hunter2’).decode(‘utf-8’)
Final Thoughts:
Any solutions to get my Mac encoding/decoding correctly? Perhaps because MacOS relies on Python 2.7 it's messing it up? But this shouldn't be the case within my virtualenv.....
I've run echo $LANG and looked at the psql server_encoding on local/heroku and they are both identical for utf8.
So! This is a mind boggling problem for a lot of people. Now that I have found a solution, I'm back to post the results.
Solution Part A: [The most important piece is in Solution Part B, this is a minor fix]. The first thing I realized was that I was using double quotes around my utf-8. I then rechecked the documentation and realized it was a single quote .decode('utf-8'). As soon as I did this, it seemed to fix the problem (at least temporarily). Why that fixes it, I'm uncertain, but that's something to try and a small detail to overlook. After a few days of more pushes, the bug popped back up.
Solution Part B: This is the much larger problem that I learned. After hours of searching I stumbled on a google search that was something along the lines of "Flask-bcrypt py-bcrypt conflict". There were some ambiguous stack overflow questions and github issues that lead me to realize there was likely something conflicting between these packages. So naturally I removed them an reinstalled py-bcrypt, flask-bcrypt, and bcrypt. Same problem. Then I did it again in a different order....new problem....about ffi being missing. So then I uninstalled all of them and ONLY installed flask-bcrypt. Well wouldn't you know...that fixed the problem for Heroku and my local. It turns out that when you install flask-bcrypt it auto installs bcrypt. I left py-bcrypt uninstalled entirely. It seems bcrypt and py-crypt really don't like each other.
Hope that fixes it for you!
(note: I do have this feeling that bcrypt is still accessing py-bcrypt in some way, maybe through headers or the python package itself. Regardless, removing it from my virtual environment did the trick).
(alternative solution: I heard if these packages just really don't play nice, you can use generate_password_hash from something like werkzeug or try installing the cryptography package. I didn't want to go that route though, but worth a shot).
I have been trying to use the django-visits module, though I seem to not even get this to run cause the minute I follow the instructions for just adding it to my application here:
https://bitbucket.org/jespino/django-visits/src/c3ac83b91969?at=default
It gives me an error when I try to run server:
ERRORS:
visits.Visit.ip_address: (fields.E900) IPAddressField has been removed
except for support in historical migrations.
HINT: Use GenericIPAddressField instead.
Their hint was helpful enough, but I have no idea where pip instaleld my django-visits to where I can change the model code of this module to fix the IPAdressField
Am I approaching solving this error wrong? Should I not be looking for the original code that was installed somewhere on my machine? Do I need to somehow install this from source and not use Pip since I have to change the models.py in this module?
(I am trying to make this work on my OS X machine but ultimately will need to get this to work on CentOS box). Also the database is postgres/postgis
Recently I tried to install Trac on my Fedora 15, but I got trouble.
I followed steps with this link: http://www.diybl.com/course/6_system/linux/Linuxjs/20100524/204237.html
Yeah, it was wonderful and finally it worked. But after I add a [header_logo] section in trac.ini, it came out this error. And I tried to delete the [header_logo] section, but strangely it wouldn't work. And I don't know why.
I have searched the internet and got this link: http://axcoto.com/blog/article/840.
Yeah, as this link says, it is a permission error. But even after I change all things to the top level of permission, it didn't work either. I must confess that I'm bored. Can anyone help me? Thanks with all my heart.
The [header_logo] section is totally unrelated to the other issue - Trac complaining for not getting a connection to the Trac db backend.
Corresponding settings for that are in section [trac] (with default value):
database = sqlite:db/trac.db
more like user, passwd,... depending on your db type
Two more things to look at:
create a second, fresh Trac environment and compare the trac.ini in it against the one you've possibly damaged (You know the diff command, don't you?)
compare permission settings of your Trac db file /db/trac.db
I recently had this problem too when I had the migrate an old SVN/Trac system to an internally available legacy box and it turned out that SQLite wasn't installed on my system.
I'm on Ubuntu and simply had to do a:
sudo apt-get install sqlite
For me this solved the problem.
i am working on a simple employee listing Django application. i wanted to include filtering in my app, so tried installing django-filter module. i think django-filter is not installed properly ( i am not going to use it anyway). But after doing this, when i try to run my application, it gives this ,
"`ViewDoesNotExist at /employeeList/` ;
Could not import task.employeeDetails.views. Error was: Could not find the GEOS library (tried "geos_c", "GEOS"). Try setting GEOS_LIBRARY_PATH in your settings "
. while i searched for the error,came to know the error is due to some wrong geoDjango installation. But i dont need geoDjango and i am wondering how its throwing this error. Before doing this, my app was working fine. Somebody please help me to solve this problem.
Things to check:
Are you using the GeoDjango database classes? If your database engine is set to something like django.contrib.gis.db.backends.postgis or django.contrib.gis.db.backends.mysql, those are the geo backends. What you want is something like django.db.backends.postgresql_psycopg2 or django.db.backends.mysql. Not the lack of the "contrib.gis" part.
The other most likely possibility is that task.employeeDetails.views is importing or running something that requires GEOS.