So, I have a Django app, that is connected to a MongoDB database on my local machine.
I brought my Django app on a Redhat Linux server. So, now I need MongoDB to be installed on the server:
1- Do I need to have access to the root on Linux server to install MongoDB?
2- I could not find any straight forward instruction to what to do for migration of MongoDB. Do know any references?
I appreciate if you could help me with this.
Thanks
First, you should capture the database file:
Find this directory on windows cmd:
C:\Program Files\MongoDB\Tools\100\bin
write the following in the cmd:
“mongoexport --db --collection --out
output.json”
find the database JSON file in that directory
Now you should export you database to the server directory:
scp -r /mnt/d/database.json
#:/home/...
Now you should import the mongodb database:
mongoimport --db --collection --file
Related
I've already pushed my Django files to Heroku via Git and now I'd like to configure at Heroku server the Postgres database. After that, I need to transfer my local sqlite database to Heroku Postgres.
All of this issue is because I don't have admin rights on my local PC (corporate unit) to install Postgres.
So basically:
1. Configure remotely Postegres at Heroku;
2. Migrate local database (sqlite) to Heroku (Postgres).
I don't know if there is another path to go on...
Thank you!
That's some crazy gymnastics you're trying to do. Getting a grasp of PostgreSQL setup is hard as it is. There are several user/table privileges you have to maintain. Sqlite3 has very simple settings in the settings.py file in Django, while Postgres requires a username, password, Host, and Port.
Also the sql you export from sqlite3, might not ingest directly into the PostgreSQL. See this. You'll have to install Postgres on your local machine, if you plan to have any sort of ok workflow as far as I can see. You can probably explore docker to create a local dev environment on your corporate PC.
I'm trying to setup a django app with memcached. I have the app working via virtualenv on nitrous.io without memcached.
I ran parts install memcached which worked fine. python-memcached is also installed in the virtualenv. I tried running:
memcached -d -m memory -s $HOME/memcached.sock -P $HOME/memcached.pid
which I do on my production server. But I got this error:
failed to set rlimit for open files. Try starting as root or requesting smaller maxconns value.
The user rights and whatnot are a little out of my scope of knowledge?
You should always use parts start memcached to run the service on Nitrous.IO.
To change the configuration for the memcached package, edit /home/action/.parts/etc/memcached.conf.
I am trying to deploy a Django application on Google Compute Engine. I'm using a Debian 7 image and want to set up Django with Nginx, Gunicorn, virtualenv, supervisor and PostgreSQL. I have everything running fine on my development machine which is running Ubuntu 14.04 with Django installed and PostgreSQL as the backend.
I'm using the tutorial located at http://datacommunitydc.org/blog/2013/12/a-tutorial-for-deploying-a-django-application-that-uses-numpy-and-scipy-to-google-compute-engine-using-apache2-and-modwsgi/. I'm also using the tutorial located at http://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/ as it's specific to virtualenv and PostgreSQL which I'm using on my development machine. I've setup my GCE instance, instaled and updated aptitude. I've installed PostgreSQL however when I attempt to create a database user and a new database for the app I get an error and nothing is created.
Following the tutorial I've run:
$ sudo su - postgres
postgres#django:~$ createuser -P
Enter name of role to add: hello_django
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
When it attempts to create the new user role I receive the following error:
createuser: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
When I run the shell script ls /etc/init.d it says that postgresql is running, but I still can't add the new role. Can someone tell me what I'm doing wrong?
Regards.
I wasn't able to reproduce the issue on my end, but it appears to be an issue with PostgreSQL and its dependencies. You can try removing all installed PostgreSQL components and dependencies and then reinstalling PostgreSQL:
sudo apt-get remove --purge postgresql-9.1*
sudo apt-get install postgresql-9.1
If it's still unable to connect to the database, the issue might be originating from your $PATH, in which case you'll need to point it to /usr/local/bin/psql.
I have just had the same problem.
This is most likely cause the postgres cluster has not been initialised yet.
And the reason that this didn't install automatically is because you have set up the locale of the box yet. This is something that has to be done on Amazon EC2 instances as well.
You need to run:
sudo apt-get install locales
And then:
sudo dpkg-reconfigure locales
I had to choose which locales I wanted to setup, I chose en_AU UTF-8.
After this I rebooted, then I could run this to initialise the cluster:
sudo pg_createcluster 9.1 main --start
This started the service and created the pg_hba.conf files etc.
I faced a similar problem a while back. It can resolved using a few simple steps:
As postgres user run : initdb --locale en_US.UTF-8 -E UTF8 -D 'var/lib/postgres/data'. Note depending on the distro postgres in the command can be pgsql. You can easily check if the directory exists with an ls command.
systemctl start postgresql (if you have systemd) or just a /etc/init.d/postgresql start should do. These commands must be rub as the superuser.
All this is from the ArchWiki.
I'm trying to follow the steps listed here to get PostGIS working with Postgresql and Django on 0SX 10.8 Mountain Lion. However, when I get to step 6: createdb -U USERNAME -E utf8 geodjango I get an error:
createdb: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
How can I move forward with the installation process here? Is this the right method? Thanks for your ideas!
I finally got my Django app to deploy on Heroku, using Vagrant and Postgres for both local and production. The localhost is up and running, and I'm in the admin, adding users. But when I run
heroku run python manage.py syncdb
it barfs up this error:
psycopg2.OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Same thing happens when I try to access the admin online: http://vast-sierra-7949.herokuapp.com/admin/
I'm new to Heroku, and I've tried just about every getting started tutorial I could find, including
http://gettingstartedwithdjango.com/en/lessons/introduction-and-launch/
https://devcenter.heroku.com/articles/django,
https://github.com/callmephilip/django-heroku-bootstrap, and
https://github.com/jpadilla/django-project-template
This last github link actually allowed me to deploy, before I was just getting an error when I ran
git push heroku master
and that error was: manage.py: error: no such option: --noreload
I know there are several posts with this error, but I've looked through as many as I could find with no luck on resolving the issue.
Thank you in advance,
Anthony
Be sure to setup heroku DB settings
Check out this blog post: http://jamie.ideasasylum.com/2012/09/connecting-navicat-to-postgresql-on-vagrant/
The author talks about how you have to modify pg_hba.conf by adding the following lines to allow a host machine (in this case, you Heroku instance) to connect to a postgres server installed on a guest VM within the host.
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 10.0.2.2/32 md5
I'm not sure if you can access these files on a Heroku instance, but it's a place to start. Good luck!