标签: pythonanywhere

需要在pythonanywhere上杀死被困的进程

调度页面上的kill按钮目前在pythonanywhere上不起作用.在我等待ResolverSys乐于助人的支持时,有什么想法可以解决吗?

我目前无法从控制台打开新进程我的计划任务未运行.

然而,我可以通过SSH进入,所以如果有一个想法,我可以帮助自己.

python pythonanywhere

3
推荐指数
1
解决办法
757
查看次数

pythonanywhere的django settings.py

我有 django 应用程序,我在本地开发并部署到 pythonanywhere。

本地 Setting.py 包含 sqlite-db、本地静态路径等。 pythonanywhere 上的 Setting.py 包含 mysql-db、静态的 cdn 链接等。

我想在我的 git 中有一个设置文件,有一些像这样的检查

if host_type=='pythonanywhere':
    DATABASES = { "default": { "ENGINE": "django.db.backends.mysql",
Run Code Online (Sandbox Code Playgroud)

为此,settings.py 的最佳实践在哪里?

pythonanywhere 提供了哪些 os.environ?

django-settings django-staticfiles pythonanywhere

3
推荐指数
1
解决办法
918
查看次数

Django:远程访问PythonAnywhere MySQL数据库

我在 PythonAnywhere 上有一个 Django 应用程序(Python 3.4、Django 1.7)以及一个 MySQL 数据库。 数据库在已部署的应用程序上运行良好。

但是,我无法将其连接到本地计算机上的应用程序。

当我运行时抛出以下错误python manage.py runserver

django.db.utils.InterfaceError:(2003,“2003:无法连接到'mysql.server:3306'上的MySQL服务器(提供8个节点名或服务名,或未知)”,无)

这些是我使用的属性:

DATABASES = {
    'default': {
        'ENGINE': 'mysql.connector.django',
        'NAME': '<username>$<database_name>',
        'USER': '<username>',
        'PASSWORD': '<databse_password>',
        'HOST': 'pythonanywhere.com'
    }
}
Run Code Online (Sandbox Code Playgroud)

我也尝试过mysql.servermysql.server.pythonanywhere.comHOST没有任何运气。

python mysql django pythonanywhere

3
推荐指数
1
解决办法
1996
查看次数

从pythonanywhere打开网址

这段代码在我的本地机器上运行良好,但是当我在pythonanywhere.com上传并运行它时,它给了我这个错误.
我的代码:

url = "http://www.codeforces.com/api/contest.list?gym=false"
hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
                'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
                'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
                'Accept-Encoding': 'none',
                'Accept-Language': 'en-US,en;q=0.8',
                'Connection': 'keep-alive'}
         req = urllib2.Request(url, headers=hdr)
         opener = urllib2.build_opener()
         openedReq = opener.open(req, timeout=300)
Run Code Online (Sandbox Code Playgroud)

错误:

Traceback (most recent call last):
File "/home/GehadAbdallah/main.py", line 135, in openApi
    openedReq = opener.open(req, timeout=300)
  File "/usr/lib/python2.7/urllib2.py", line 410, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line …
Run Code Online (Sandbox Code Playgroud)

python urllib2 pythonanywhere

3
推荐指数
1
解决办法
2555
查看次数

Flask 和 JavaScript 确认删除前

我在 pythonanywhere 上发布的 Flask 应用程序有问题。这是一个仪表板,如果我单击帖子的标题,它应该会显示帖子的详细信息。我想在删除之前添加确认消息。我怎样才能做到?现在我尝试使用 javascript,但它不起作用。下面是我的代码。

应用程序

import MySQLdb as mysql
con = mysql.connect("host", "username", "password", "database")
con.ping(True)

@app.route('/deleteschool/<int:School_Id>')
def deleteschool(School_Id):
try:
    if session.get('user'):
        #con = mysql.connect()
        cursor = con.cursor()
        query_string = "DELETE FROM school WHERE School_Id = '{School_Id}'".format(School_Id=School_Id)
        cursor.execute(query_string)
        #cursor.execute("DELETE from school where School_Id=%s", (School_Id))
        delete=cursor.fetchall()
        if len(delete) is 0:

            con.commit()
            return redirect('/getSchoolList')
        else:
            return redirect('/error')


    else:
        return redirect('/error')
except Exception as e:

    return redirect('/error')
Run Code Online (Sandbox Code Playgroud)

school_page_showpost.html

<script src="/static/js/confirm.js"></script>
{% for row in schoolpost %}
                <div id="titleOutput" class="two fields">
                    <div …
Run Code Online (Sandbox Code Playgroud)

html javascript python flask pythonanywhere

3
推荐指数
1
解决办法
4783
查看次数

运行 WSGI 应用程序时出错,ModuleNotFoundError:没有名为“mysite”的模块

我正在尝试使用 pythonanywhere 通过项目部署我的 Django 项目,但我遇到了问题并且真的陷入了困境。谁能帮我解决这个问题。图像附加到我的setting.py 文件的路径。settings.py 的路径

Webttab上的WSGI.py配置是:

path = '/home/technewsandblog/blog/blog_project/mysite'
if path not in sys.path:
sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

# then:

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Run Code Online (Sandbox Code Playgroud)

我重新加载后显示的错误是:

Error running WSGI application
2018-07-08 20:30:23,383: ModuleNotFoundError: No module named 'mysite'

2018-07-08 20:30:23,383:   File "/var/www/technewsandblog_pythonanywhere_com_wsgi.py", line 18, in <module>

2018-07-08 20:30:23,383:     application = get_wsgi_application()

2018-07-08 20:30:23,384: 
2018-07-08 20:30:23,384:   File "/home/technewsandblog/.virtualenvs/myDjangoEnv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application

2018-07-08 20:30:23,384:     django.setup(set_prefix=False)

2018-07-08 20:30:23,384: 
2018-07-08 20:30:23,384:   File "/home/technewsandblog/.virtualenvs/myDjangoEnv/lib/python3.6/site-packages/django/__init__.py", line 19, in setup

2018-07-08 …
Run Code Online (Sandbox Code Playgroud)

python django pythonanywhere

3
推荐指数
1
解决办法
2万
查看次数

为什么 Instagram 不能与 Selenium headless Chrome 一起使用?

我正在尝试构建一个无头工作的 insta 机器人,但它似乎找不到用户名、密码列(即 NoSuchElementException)。

我尝试运行此代码来排除故障。(基本上打开ig主页并截图)

from selenium import webdriver
from time import sleep

options = webdriver.ChromeOptions()
options.headless = True
options.add_argument("--window-size=1920,1080")
browser = webdriver.Chrome(options=options)
browser.get("https://www.instagram.com")
browser.get_screenshot_as_file(f"screenshot.png")
Run Code Online (Sandbox Code Playgroud)

我得到的这些屏幕截图基本上用法语说“错误,几分钟后重试”

我尝试通过 selenium 找到“connectez-vous”按钮,但是我尝试的每个 xpath 都不起作用,而且不可能通过 f12 找到它

该机器人稍后将上传到 pythonanywhere,以便我可以在云中运行它(所以如果您认为我可能遇到其他问题,您可以告诉我)

你建议我做什么?

python selenium headless selenium-chromedriver pythonanywhere

3
推荐指数
1
解决办法
3058
查看次数

Pythonanywhere Web2Py重定向到HTTPS

我已经创建了一个webproject Web2Py,并希望用户在正常的http://instaed 上访问这些页面http://.

每次我输入http://domain.pythonanywhere.comet重定向我http://domain.pythonanywhere.com.

它的时间为0.5秒.进行SSL检查,我想避免这种情况.

这是默认值:

## if SSL/HTTPS is properly configured and you want all HTTP requests to
## be redirected to HTTPS, uncomment the line below:
# request.requires_https()
Run Code Online (Sandbox Code Playgroud)

python web2py pythonanywhere

2
推荐指数
1
解决办法
760
查看次数

Web2py第三方认证

我使用web2py在python中创建了一个webapp,它使用Janrain进行第三方认证.
在我的本地服务器上它工作得非常好,但是现在当我在pythonanywhere上部署时,身份验证会给我以下错误

"class'urllib2.URLError'urlopen错误隧道连接失败:403 Forbidden"

===========

  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
URLError: <urlopen error Tunnel connection failed: 403 Forbidden>
Run Code Online (Sandbox Code Playgroud)

==========================

对于第三方身份验证,我使用过yahoomail id.

janrain python-2.7 pythonanywhere

2
推荐指数
1
解决办法
197
查看次数

PythonAnywhere:尝试使用easygui模块时出现Tkinter.py错误

我的儿子正在尝试使用pythonAnywhere执行一个小程序.

import random, easygui
secret = random.randint(1,99)
guess = 0
tries = 0
easygui.msgbox ("AHOY! I'm the Dread Pirate Roberts, and I have a    secret!\n"
"It is a number from 1 to 99. I'll give ye 6 tries.")
while guess != secret and tries < 6:
    guess = easygui.integerbox ("What's yer guess, matey?")
    if not guess: break
    if guess < secret:
        easygui.msgbox (str(guess) + "is too low, ye scurvy dog!")
    elif guess > secret:
        easygui.msgbox (str(guess) + "is too high, …
Run Code Online (Sandbox Code Playgroud)

python bash tkinter pythonanywhere

2
推荐指数
1
解决办法
414
查看次数