problem after moving from sqllite3 to postgresql database in django - python-3.x

enter image description hereI have changed an existing database for a Django project from SQLite3 to PostgreSQL. As presently i am in development environment, and was carrying some dummy data in my SQlite3 so do not need that data.
After changing the database from sqlite3 to PostgreSQL, I run the makemigrations, and migrate commands, and then created a super user.
Now when i try to access the admin panel, by http://127.0.0.1:8000/admin/ django is showing me the following error. I have search a lot for the solution, but failed. I would be grateful, if you could please help me in this.
errorerror2

Looks like your sessions wasn't migrated properly.
Ensure that you have django.contrib.sessions in INSTALLED_APPS and try migrate the sessions again from scratch.
You can do it running:
$ python manage.py migrate --fake sessions zero
$ python manage.py migrate sessions

Related

Node JS db-migrate for different database

I'm already using db-migrate package to migrate MySQL database script and it works well, I've even setup the DATABASE_URL variable in the server environment.
Now I've a requirement to store few details in the sqlite in the same service, I checked db-migrate package for this feature apparently nothing mentioned regard to the executing sql scripts in multiple different databases at one go. Is it possible to do in db-migrate? or do I've to write my own service for this?

Migration generator files tools for nodejs and postgresql

I use nodejs and i have a postgresql database and I'm thinking of using sequelize or db-migration to migrate my existing database. Do you know a way to generate the migration files for my existing database?
Node.js database migration management for Postgresql
Here is how to go about it.
There exist a node package manager called node-pg-migrate
install the package using npm install node-pg-migrate pg
here is the github URL with code samples. https://github.com/salsita/node-pg-migrate#node-pg-migrate
Best of Luck

jhipster - how to load data from a database and show data?

I'm learning JHipster and a beginner (web developper).
Can someone show me step by step for loading data in a database (h2 or mysql or oracle) within JHipster application and showing to the home page?
Thanks in advance,
First, you should look at the jhipster documentation to generate an app : see this 12 minute video tutorial
Jhipster actually does a lot for you, it generates the back-end with your classes, logging, database interfacing ... But also creates a nice-looking front-end for you.
Next you should have a database up and running. In the choices you have mentioned, I think Mysql could be the most interesting for a beginner as you would have a good visibility on your database (h2 is mostly in memory, I use it for testing on my app) and the install should be simple enough.
In order to do that, you could use docker or install it manually.
For docker, you just have to type the following command :
docker run -p 3306:3306 --name mysql_instance_01 -e MYSQL_ROOT_PASSWORD=pass -d mysql
And then if you want to stop it :
docker stop mysql_instance_01
See the docker documentation for more information about install and usage : this link
To connect and administrate your database graphically, you can use dbeaver, it is free and easy to use.
Once you have generated the app and the database is running, you have different options : either you add your 'entities' and manually populate your database, or you create an SQL script to do it for you (Which is specific to the database you're using).
JHipster is using liquibase which will automatically translate the entities created in Jhipster into your database.
This is a short introduction, I strongly advise you read the jhipster documentation. For example, this video shows what Jhipster can do and how to use it.
Hope this helps.
You can read this link, a basic jhipster example

How to make a database on c9.io

How can I make a database on c9.io?
You have here all docu about this:
https://community.c9.io/t/setting-up-phpmyadmin/1723
Basically:
mysql-ctl install
phpmyadmin-ctl install
mysql-ctl start
You can create a temporary MySQL Database in Cloud9 in the terminal using
mysql-ctl cli
See Set Up a Database.
However, if you do not wish to learn MySQL, I would recommend Getting Started.

Distributable database with my application

I am creating a NodeJs Desktop application using node-webkit and right now using MongoDB as a database.
I want to distribute it as an executable where users will be able to use the application without installing the database by utilizing their own copy of local DB.
Is there a way i can make a local copy for their DB during the installation.
If it is not possible in MongoDB, what other DB should i use?
well its based on your data needs, if you have large set of data you should use mongoDB otherwise there are lots of databases for your NWJS app. check this link https://github.com/nwjs/nw.js/wiki/Save-persistent-data-in-app some of them are good enough to hold big data. but personally i prefer sqlite3 with NWJS(there is a lot of hustle to install it for NWJS) sqlite can work with large data check this page for more info.
if you are going with mongoDB then you should download the the zip not the installer and pack it with your installer the you should be good to go.
by default mongoDB stores its data in /data/db but you can change it to your preferred location

Resources