Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialmaml
13,996 PointsHeroku Restore: Rookie Question
I am trying to create a local copy of an app that was created on Heroku that a previous developer made but abandoned. From what I see, it appears the app was created with Python/Django and Postgres (I'm more of a front-end guy so I could be missing some pieces to this).
What I've done:
I've downloaded Python, Postgres, Virtualenv and the Heroku Toolbelt. I am running the latest version of Yosemite.
Thus far, I have downloaded a PostgreSQL 9.3.6 database from Heroku Dev Center that appears to be the database file.
At this point, I'm not sure what to do with this file that appears to be named like a serial number.
My goal is to create a working local copy of this app using this Postgres file from Heroku. I'm determined to get it up and running. Any help would be greatly appreciated. Thanks.
1 Answer
Seth Reece
32,867 PointsHave you cloned the project with heroku git:clone ? https://devcenter.heroku.com/articles/git-clone-heroku-app
maml
13,996 Pointsmaml
13,996 PointsHi Seth. Yes, I ran heroku git:clone - a APP which successfully cloned my app. I'm not really sure what to do next though.
Seth Reece
32,867 PointsSeth Reece
32,867 PointsAre you trying to load it in your browser? This is usually done with python app.py then opening the link python tells you your app is running on.
maml
13,996 Pointsmaml
13,996 PointsI have the Python Launcher open but I'm not sure what it is/how to configure it. I would like to get this up and running in my browser yes. How do I find the link python tells me my app is running on?
Seth Reece
32,867 PointsSeth Reece
32,867 PointsIf your trying to install Python on Mac you just let the installer do everything at default. To run your app, inside the app directory in your terminal type "python app.py" Usually app.py is the name of the main app file. If not there should be a file ending in
Once your app is running it will give you a link in your terminal. Usually http://127.0.0.1:5000 i think.
maml
13,996 Pointsmaml
13,996 PointsI have python installed. In my app directory I see:
When I run python manage.py I see:
Traceback (most recent call last):
File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/site-packages/django/core/management/init.py", line 338, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/site-packages/django/core/management/init.py", line 312, in execute django.setup() File "/usr/local/lib/python2.7/site-packages/django/init.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate app_config = AppConfig.create(entry) File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 86, in create module = import_module(entry) File "/usr/local/Cellar/python/2.7.10_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/init.py", line 37, in import_module import(name) ImportError: No module named widget_tweaks
Seth Reece
32,867 PointsSeth Reece
32,867 PointsCheck the requirements.txt file. It should tell you any additional add-ons you need to run the app. That particular error is looking for a module named widget_tweaks. Try here: https://github.com/kmike/django-widget-tweaks
maml
13,996 Pointsmaml
13,996 PointsThat is helpful. I've made some progress by installing all the dependencies from the requirements.txt file. The error I see now is:
% python manage.py /usr/local/lib/python2.7/site-packages/south/db/postgresql_psycopg2.py:4: RemovedInDjango19Warning: The django.db.backends.util module has been renamed. Use django.db.backends.utils instead. from django.db.backends.util import truncate_name
There is no South database module 'south.db.postgresql_psycopg2' for your database. Please either choose a supported database, check for SOUTH_DATABASE_ADAPTER[S] settings, or remove South from INSTALLED_APPS.
When I cloned the app it should have brought the database with it correct? Or is this a different step?
Seth Reece
32,867 PointsSeth Reece
32,867 PointsNo. The database is never included in a clone!!!!! First, it's a major security issue. Second, development and test databases should never have anything to do with production database. i.e. If you had to rebuild your production database every time you made a change during development or test, all your users would lose all their data in production! (The exclamation points aren't yelling, these are very important.) "python manage.py db init" should get your local database up.
maml
13,996 Pointsmaml
13,996 PointsThanks for the clarification. I ran python manage.py db init and I received the same error:
python manage.py db init /usr/local/lib/python2.7/site-packages/south/db/postgresql_psycopg2.py:4: RemovedInDjango19Warning: The django.db.backends.util module has been renamed. Use django.db.backends.utils instead. from django.db.backends.util import truncate_name
There is no South database module 'south.db.postgresql_psycopg2' for your database. Please either choose a supported database, check for SOUTH_DATABASE_ADAPTER[S] settings, or remove South from INSTALLED_APPS.
Seth Reece
32,867 PointsSeth Reece
32,867 PointsLooks like there's a deprecation warning concerning django.db.backends.util needs to be django.db.backends.utils. There's a topic on stackoverflow concerning South in Django that might be helpful http://stackoverflow.com/questions/6172209/how-should-i-be-setting-south-database-adapters-for-my-django-app-that-uses-sout