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 1031255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T13:53:55+00:00 2026-05-16T13:53:55+00:00

After fighting with different things here and there, I was finally able to get

  • 0

After fighting with different things here and there, I was finally able to get BottlePY running on Apache and run a MongoDB powered site. I am used to running Django apps, so I will be relating to that a bit in my question.

The Problem

Every time a page is loaded via BottlePY, the connection to the MongoDB database located on MongoHQ.com needs to be re-authenticated (meaning it probably had to reconnect).

What I Found

I attached a db.keep_alive() function to the top of each model function, so that before any mongodb query is run, it trys to run a simple query. If it fails, it catches the OperationFailure or AutoReconnect errors and then calls the db.authenticate() function. After it reauthenticates, I have it add a log to a logs db to monitor how often it needs to reauthenticate. Currently, it needs to reauthenticate on every page load (that requires running a query). This isn’t right.

Difference from Django

I use this same concept in django, and have found that the db connection only needs to be authenticated after 10-15 minutes of no queries being run.

I don’t understand why creating a pymongo connection in django would be different from creating one in bottle, since I am using the same driver, functions and methods. I am not using any ORMS or anything like that either.

Versions

  • Bottle: 0.9.dev
  • Django: 1.2.1 final
  • PyMongo: 1.8

I appreciate the help!

Update: A friend was able to take a quick look and noticed the following that may help with answering my question.

It appears that each request is
launching a new Python process, as
opposed to Django, in which a single
process remains running for a long
period of time.

  • 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-05-16T13:53:55+00:00Added an answer on May 16, 2026 at 1:53 pm

    This just ended up to be a weird thing between Bottle and MongoHQ. No real solution was found, but I couldn’t recreate it with other frameworks. Any other ideas are appreciated.

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

Sidebar

Related Questions

After some time researching and trying different things I still cannot get my @ExceptionHandler
After nearly 10 hours of searching and trying different things I couldn't figure out,
After discovering about Javascript namespaces, I tried to implement them but I run into
After a system upgrade i am no longer able to start my tomcat5 server.
After I deployed WCF web service to Windows server 2008 R2, I was able
After fighting all morning, I got the handshake to work but now I'm stuck
After fighting several versions of the CoreKeyGen created by some minamoto guy, a new
I've been fighting with jQuery all night and getting quite frustrated here, so forgive
After a day or two, I am still fighting with Mod Rewrite. It seems
I have an assignment and after hours of pondering and fighting off my illness

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.