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

  • Home
  • SEARCH
  • 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 6475783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:44:47+00:00 2026-05-25T06:44:47+00:00

I’m making a project using GAE, and have a terrible problem. I wanted to

  • 0

I’m making a project using GAE, and have a terrible problem.

I wanted to make a twitter bot, so I started the first step with posting tweets. I made the ‘tweets.txt’ in the same folder as the ‘dailybasic.py’.

Here’s some parts of the codes.

#app.yaml

application: mathgirlna
version: 1
runtime: python
api_version: 1

handlers:
# - url: /static
#  static_dir: static

- url: /dailybasic   
  script: dailybasic/dailybasic.py 

- url: /.*
  script: main.py

main.py (it works, no error)

#!/usr/bin/python  
# -*- coding: utf-8 -*-

import os
import sys

from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
import wsgiref.handlers

class MainPage(webapp.RequestHandler):
    def get(self):
        path = os.path.join(os.path.dirname(__file__), 'index.html')
        self.response.out.write(template.render(path, None))


application = webapp.WSGIApplication([('/', MainPage)],
                                     debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()

dailybasic.py (run every 5 minutes)

#!/usr/bin/python  
# -*- coding: utf-8 -*-

import os
import sys
from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext.webapp.util import run_wsgi_app
import tweepy
import wsgiref.handlers
import time

def tweetit(tweet):
   if len(tweet)<140:
      api.update_status(tweet)
   else:
      diaryentries.append(tweet)

consumer_key = '******************'
consumer_secret = '*******************************************'
access_token = '**************************************************'
access_token_secret = '****************************************'

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)

class dailybasic(webapp.RequestHandler):
    def get(self):
        now = time.localtime()
        path = os.path.join(os.path.dirname(__file__), 'tweets.txt')
        f_db = open(path, 'r')
        db = f_db.readline() 
        while db != '':
            todaynow = []
            wday = now.tm_wday
            if db[(wday+1)%7]=='1' and now.tm_hour * 60 + now.tm_min <= int(db[8:10]) * 60 + int(db[11:13]) and now.tm_hour * 60 + now.tm_min + 5 > int(db[8:10]) * 60 + int(db[11:13]) :
                todaynow.append(db[14:])
        if(len(todaynow) != 0):
            import random
            tweetit(todaynow[random.randrange(0,len(todaynow)-1)])


application = webapp.WSGIApplication([('/dailybasic', dailybasic)],
                                     debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()

cron.yaml

cron:
- description: day process
  url: /dailybasic
  schedule: every 5 minutes from 06:00 to 01:30
  timezone: Asia/Seoul

I googled about this problem, and tried everything I can put in that ‘##’ part of the ‘app.yaml’, but it didn’t worked(it was able to be deployed, but GAE warned as ‘File referenced by handler not found: dailybasic.py’).

Here’s a file tree:

  • root
    • dailybasic
      • dailybasic.py
      • tweets.txt
    • main.py
    • app.yaml, cron.yaml, index.yaml
    • index.html

I want to keep the ‘index.html’ contains only html codes, without any scripts.

How should I place the files and write the app.yaml?

(And sorry for the poor English)

*added

The problem is, open() doesn’t works, because the ‘tweets.txt’ is not uploaded or in the wrong directory.

  • 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-25T06:44:47+00:00Added an answer on May 25, 2026 at 6:44 am

    Paths are specified relative to the directory containing app.yaml, so try this:

    handlers: 
    - url: /dailybasic   
      script: dailybasic/dailybasic.py 
    

    Did you want to map the file index.html to the root url / ? App engine doesn’t do this automatically like some other web servers. To do this mapping, try something like this:

    - url: /
      static_files: index.html
      upload: index.html
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I have thousands of HTML files to process using Groovy/Java and I need to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

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.