Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9139055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:20:15+00:00 2026-06-17T09:20:15+00:00

I have a app that is deployed to Heroku, and I’d like to be

  • 0

I have a app that is deployed to Heroku, and I’d like to be able to run the test suite post-deployment on the target environment. I am using the Heroku Postgres add-on, which means that I have access to a single database only. I have no rights to create new databases, which in turn means that the standard Django test command fails, as it can’t create the test_* database.

$ heroku run python manage.py test
Running `python manage.py test` attached to terminal... up, run.9362
Creating test database for alias 'default'...
Got an error creating the test database: permission denied to create database

Is there any way around this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:20:16+00:00Added an answer on June 17, 2026 at 9:20 am

    Turns out I was in the wrong. I was not testing what I thought was being tested… Since Heroku’s Routing Mesh was sending requests to different servers, the LiveServerTestCase was starting a web server on one machine and Selenium was connecting to other machines altogether.

    By updating the Heroku Procfile to:

    web: python src/manage.py test --liveserver=0.0.0.0:$PORT

    overriding the DATABASES setting to point to the test database, and customizing the test suite runner linked to below (the same idea still holds: override setup_databases so that it only drops/re-creates tables, not the entire database), I was able to run remote tests. But this is even more hacky/painful/inelegant. Still looking for something better! Sorry about the confusion.


    (updated answer below)

    Here are the steps that worked for me:

    • Create an additional, free Postgres database using the Heroku toolbelt

    heroku addons:add heroku-postgresql:dev

    • Use the HerokuTestSuiteRunner class which you’ll find here.

    This custom test runner requires that you define a TEST_DATABASES setting which follows the typical DATABASES format. For instance:

    TEST_DATABASES = {
        'default': dj_database_url.config(env='TEST_DATABASE_URL')
    }
    

    Then, have the TEST_RUNNER setting be a Python path to wherever HerokuTestSuiteRunner can be found.

    You should now be able to run Django tests on Heroku using the given database. This is very much a quick hack… Let me know how it could be improved / made less hackish. Enjoy!


    (original answer below)

    A few relevant solutions have been discussed here. As you can read in the Django docs, “[w]hen using the SQLite database engine, the tests will by default use an in-memory database”.

    Although this doesn’t thoroughly test the database engine you’re using on Heroku (I’m still on the lookout for a solution that does that), setting the database engine to SQLite will at least allow you to run your tests.

    See the above-linked StackOverflow question for some pointers. There are at least two ways out: testing if 'test' in sys.argv before forcing SQLite as the database engine, or having a dedicated settings file used in testing, which you can then pass to django manage.py test using the --settings option.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a django app deployed on heroku that needs to make POST requests
I have a click-once deployed app that uses a notification icon created using the
I have a Ruby on Rails app that I've recently deployed to a remote
I currently have a deployed app (fortworth.herokuapp.com) that I am attempting to sort movies
I know that after I have deployed my ipad/iphone app into App Store, it
I have an app that is deployed to Tomcat 7 and is currently clustered
I am trying to run Haskell on Heroku. I have compiled a binary app
I deployed a Ruby on Rails app to Heroku, and I realized they have
I have my app deployed with heroku and have a SSL configured to one
I have a Rails app deployed on Heroku and I have a git repo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.