Django PostGIS Locally Installing / Running - django

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!

Related

MongoDB migration from local host to a Linux server

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

Postgres 9.3 could not connect to server

Running into the a similar issue as that mentioned here Postgres could not connect to server
I am trying to run rake db:create on a rails 4.1.4 project. I have tried everything mentioned in the previous post - any other suggestions are welcome.
Furthermore, after reinstalling postgres, I ran the command
brew info postgresql and got this Conflicts with: postgres-xc (though I'm not sure if this is relevant). I'm running postgres 9.3.4
Any help will be greatly appreciated...Thanks!
Update: This is the exact error:
could not connect to server: Socket operation on non-socket
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Things I've tried so far:
brew uninstall postgresql
brew update
brew upgrade
brew install postgresql
followed by the list of commands here http://www.postgresql.org/docs/9.3/static/server-start.html
Finally, using the lunchy gem to start postgres worked - http://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/
Finally, using the lunchy gem to start postgres worked -
http://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/Thanks

Django on Vagrant, Postgres both locally and on Heroku, could not connect to server: No such file or directory

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!

Trying to set Django and postgreSQL on Heroku

I'm trying to follow the Heroku tutorial on deploying Django applications:
Getting Started with Django on Heroku
I'm able to run most of it without problems, but when it comes to synching the postgreSQL database I'm getting the following message:
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"?
I've tried promoting databases,
seting the HOST to /tmp,
modifying the postgresql.conf,
and many other stuff I found searching around without success
I'm working on MB-Pro, Mac OS 10.7 (Lion), and read in some places that this OS was giving developers some headache when it comes to postgre. Did anyone have this problem on OS 10.7, and had it fixed after updating to 10.8? I'm considering updating in case it solves the problem.
Thank's in advance.
EDIT:
The command I'm trying to run is: heroku run python manage.py syncdb
EDIT:
I forgot to delete the DATABASE definition that was already defined on the file.
I made use of the PostgresApp to help with running Postgres on my Mac and then in a terminal ran;
psql -h localhost
I forgot to delete the DATABASE definition that was already defined on the file. It's working now.

Installing PostGIS on Windows

I've installed PostgreSQL and PostGIS, and now I'm trying to follow these instructions:
http://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#spatialdb-template
But I keep getting the following error, both in the command prompt and in Cygwin:
C:\Users\Home>createdb -E UTF8 template_postgis
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 "/tmp/.s.PGSQL.5432"?
And I know PostgreSQL is running, because I'm using it right now!
Installing open source applications can sometimes be so frustrating...
I'll be very grateful for your help!
Are you by any chance using cygwin here? Particuarly, is the system picking up createdb from a cygwin binary?
If your server is cygwin, try removing it and replace it with the Windows version.
If your server is the Windows version, but you have createdb from a cygwin install in the PATH, try removing cygwin from your PATH to make sure you pick up the Windows version of createdb.