dev_appserver.py Opens a Text File, Does Not Deplo

2019-06-17 05:36发布

It works fine on my other computer, but after setting up Google App Engine and creating the main.py and app.yaml files, I run dev_appserver.py app.yaml in Windows command prompt and instead of deploying the app to localhost:8080 it just opens this text file, which I will shorten:

#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""Convenience wrapper for starting an appengine tool."""

import os
import sys

sys_path = sys.path
try:
  sys.path = [os.path.dirname(__file__)] + sys.path

  import wrapper_util

finally:
  sys.path = sys_path

wrapper_util.reject_old_python_versions((2, 7))

_DIR_PATH = wrapper_util.get_dir_path(__file__, os.path.join('lib', 'ipaddr'))
_PATHS = wrapper_util.Paths(_DIR_PATH)

etc. etc.

What is going on here? Everything is set up identically to my other pc. It should work.

3条回答
仙女界的扛把子
2楼-- · 2019-06-17 05:54

you should supply project directory to dev_appserver.py not app.yaml. please refer to GAE python hello world example for more info. let's say your project-Dir is

"/home/rami/GAEproejcts/myfirstproject"

and your dev_appserver.py is at

"/home/rami/GAEinstalldirectory/"

. then just run:

$ /home/rami/GAEinstalldirectory/dev_appserver.py /home/rami/GAEproejcts/myfirstproject

this should work.

查看更多
一夜七次
3楼-- · 2019-06-17 06:03

SOLVED! The .py files were all set to open with idle.bat so I had to go into Control Panel\Programs\Default Programs\Set Associations and change the .py file association to python.exe. Now everything works like a charm.

查看更多
小情绪 Triste *
4楼-- · 2019-06-17 06:07

Is Python installed on this computer? What you're seeing is that Windows doesn't know that ".py" files are associated with Python.

Installing SetupTools on 64-bit Windows might provide some helpful info.

查看更多
登录 后发表回答