In my previous entry on working on Heroku, the necessity to avoid using Windows, and the importance of setting up Postgres. This time the task came forth to clone and run HelloHeroku, a Django Project created for the ICS691 class on Serious Game Development. After spending a long amount of time getting Heroku to run properly with Postgres in our last adventure with Heroku, it became of greater importance to try to remember exactly what to do. This time in order for the project to run successfully on Heroku the database had to be properly set up.
The basic specifications were charted on the classes webpage here, outlineing what we were to do and providing hints. In general using this and the tutorial for Heroku using Django, it is not a majorly difficult project. The difficult point comes once again from remembering the importance of setting up Postgres to handle things properly.
At the start remembering to remember to activate the virtual environment to help you keep track of when you're in the environment, especially if you haven't set up Postgres and will need to jump out of the environment to set up the user.
Activation is done using the command: source venv/bin/activate
As an alternative to the method I mentioned in the last blog entry, once can also make a user by using superuser commands like below:
sudo -u postgres createuser -D -A -P username
This will create a user, username, that you can use to handle the database you create.
Then you could also create the database:
psql -d A18DB -U username -W
Which will only work if you have your username created for Postgres otherwise it will provide an error.
If these are causing problems, you can temporarily shift into the postgres user using sudo su postgres but be warned that you'll have to be careful not to cause problems while as the postgres unit.
This proved to be the biggest roadblock in the whole endeavor and one that should be cautiously approached in any work with Heroku, Django, and Postgres. Remembering what you do when it comes to Postgres can help prevent a whirlwind of trouble. Though it took great pains for me to understand the problems that happened, hopefully the lessons I learned can help others avoid the frustration. Understanding this will save you many of the headaches you could have with the system. Though many more may occur going forward, being open to suggestions and searching the internet can help alleviate many of the problems.
Don't give up and happy coding!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment