标签: pythonanywhere

在pythonanywhere上备份mysql数据库

我是MySQL新手,知道如何使用mysqldump实用程序备份数据库.但是,我认为它没有安装在pythonanywhere上.我很感激有关如何备份我在pythonanywhere上创建的mysql数据库的任何建议.

谢谢.

mysql pythonanywhere

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

PythonAnywhere调度程序返回代码

当我从PythonAnywhere的计划任务中查看我的日志时,我发现它们充满了以下语句:

  • 2012-06-07 11:09:16 - 完成任务,耗时11.00秒,返回码为0.
  • 2012-06-08 14:41:41 - 完成任务,耗时19957.00秒,返回码为137.
  • 2012-06-08 17:33:32 - 完成任务,耗时5068.00秒,返回码为143.
  • 2012-06-07 09:09:06 - 完成任务,耗时1.00秒,返回码为1.
  • 2012-06-08 17:29:04 - 完成任务,耗时0.00秒,返回码为126.

我不清楚的是发出这些返回代码的原因.是bash吗?是Python吗?是否有可用的清单?

python pythonanywhere

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

从bash控制台重启服务器

有没有办法从bash浏览器中给出的控制台内重新启动Web服务器PythonAnywhere?我已经搜索了谷歌一段时间,但没有找到任何相关的东西.

bash pythonanywhere

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

无法让PythonAnywhere为我刮网

我一直在试验PythonAnywhere试图让一些python在Web服务器上工作.我最初从Arvixe切换,因为他们运行2.4并且PythonAnywhere的名字太吸引人了.

我的应用程序包含两个文件:phones.py和phonesearch.py​​.他们一起应该为电话价格刮取craigslist.

我在2.7本地测试,它运行得很好,生成一个带有表格和所有价格的html页面(celly.html).当我上传它时,它生成html就好了,但拒绝在我的价格列表中添加任何内容([intprices]).

我的怀疑:(a)因为它在本地工作正常,PythonAnywhere不允许它与craigslist通信; 或者(b)因为我这样做就像一个穴居人而不是使用微框架,PythonAnywhere否认我; 或(c)我对自己的错误视而不见,而且我错过了一些明显的错误.

我的Python脚本位于在/ home/tseymour/mysite的和正在生成的HTML 一样 /mysite/static/celly.html.该文件在http://tseymour.pythonanywhere.com/static/celly.html上提供

您会注意到我的所有单元格都填充了"N/A",这意味着它在try:"在SearchPhone.py中引发了一个IndexError.这意味着我的列表正在被填充!

但为什么会这样?!我相信这是因为我是PythonAnywhere n00b.

请指教.

SearchPhone.py

from BeautifulSoup import BeautifulSoup
import urllib
import re

def SearchPhone(phone):

    y = "http://losangeles.craigslist.org/search/moa?query=" + phone + "+-%22buy%22+-%22fix%22+-%22unlock%22+-%22broken%22+-%22cracked%22+-%22parts%22&srchType=T&minAsk=&maxAsk="

    site = urllib.urlopen(y)
    html = site.read()
    site.close()
    soup = BeautifulSoup(html)


    prices = soup.findAll("span", {"class":"itempp"})
    prices = [str(j).strip('<span class="itempp"> $</span>') for j in prices]

    for k in prices[:]:
        if k == '': #left price blank
            prices.remove(k)
        elif int(k) <= 75: #less than $50: probably a service (or not …
Run Code Online (Sandbox Code Playgroud)

python pythonanywhere

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

Connection拒绝了PythonAnywhere上的Twitter API

我试图在任何地方连接到Python上的Twitter流API,但总是得到连接拒绝错误.

我在我的应用程序中使用Tweepy,并测试连接我正在使用可以在repo中找到的流示例.

HEre是代码的总结:

from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream

# Go to http://dev.twitter.com and create an app. 
# The consumer key and secret will be generated for you after
consumer_key=""
consumer_secret=""

# After the step above, you will be redirected to your app's page.
# Create an access token under the the "Your access token" section
access_token=""
access_token_secret=""

class StdOutListener(StreamListener):
    """ A listener handles tweets are the received from the stream. 
    This …
Run Code Online (Sandbox Code Playgroud)

python twitter streaming twitter-oauth pythonanywhere

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

PythonAnywhere + virtualenv:"无法找到平台依赖库<exec_prefix> ..."

我在PythonAnywhere的virtualenv中运行了Python 2.7.3上的Django(1.5.1)站点.据我记忆,过去一切都很好.最近,虽然除了一些Django代码之外我没有改变任何东西,但是当我运行时,我得到以下消息pip:

(venv)11:34 ~ $ pip
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Traceback (most recent call last):
  File "/*~*//venv/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/*~*//venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py", line 16, in <module>
    import sys, os, zipimport, time, re, imp, types
ImportError: No module named time
Run Code Online (Sandbox Code Playgroud)

不用说,pip产生上述错误后根本不起作用.

当我运行pythonvirtualenv 运行时,我再次收到以下错误:

(venv)11:34 ~ $ python
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python …
Run Code Online (Sandbox Code Playgroud)

python django pip virtualenv pythonanywhere

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

Pythonanywhere'staticfiles'不是有效的标记库:找不到模板库staticfiles

在pythonanywhere中,我正在使用带有Django 1.7和Python 2.7的virtualenv

Settings.py

STATIC_ROOT = '/home/movies/pantherlist/movies/static/'
STATIC_URL = '/static/'

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'pantherlist.movies',
)
Run Code Online (Sandbox Code Playgroud)

wsgi.py

activate_this = '/home/movies/.virtualenvs/django17/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
.
.#path setup already done here
.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Run Code Online (Sandbox Code Playgroud)

我收到了错误

异常类型:TemplateSyntaxError异常值:
'staticfiles'不是有效的标记库:找不到模板库staticfiles,尝试过django.templatetags.staticfiles,django.contrib.admin.templatetags.staticfiles

异常位置:/usr/local/lib/python2.7/dist-packages/django/template/defaulttags.py in load,1054行

index.html出错

{% load staticfiles %}
Run Code Online (Sandbox Code Playgroud)

请帮忙.提前致谢.

python django django-staticfiles pythonanywhere

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

在pythonanywhere中使用Virtualenv时错误的Python版本

为了使用Pyhton 3.3和django 1.8,我使用Virtualenv(用于Web应用程序 pythonanywhere)

我按照以下说明操作:https: //www.pythonanywhere.com/wiki/VirtualEnvForNewerDjango

进入控制台,显示我使用的是3.3版本

(django18)12:04 ~ $ python
Python 3.3.6 (default, Jan 28 2015, 17:27:09) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Run Code Online (Sandbox Code Playgroud)

这也是我想要在我的网络应用中使用的版本:

Python version:3.3 (in the code pane)
Run Code Online (Sandbox Code Playgroud)

但是,当我将Virtualenv窗格指向Virtualenv目录(名为django18)时,我收到以下警告:

This virtualenv seems to have the wrong Python version (2.7 instead of 3.3).
Run Code Online (Sandbox Code Playgroud)

这是所有控制台(我在创建应用程序并指定Python版本后运行它):

        06:43 ~ $ mkvirtualenv --python=/usr/bin/python3.3 django18
Running virtualenv with interpreter /usr/bin/python3.3
Using base prefix '/usr'
New python executable in django18/bin/python3.3
Not overwriting existing …
Run Code Online (Sandbox Code Playgroud)

python django pythonanywhere

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

ImportError:没有名为myapp.settings的模块

我在本地创建了一个Django应用程序,我想在PythonAnywhere.com上托管它.我按照https://help.pythonanywhere.com/pages/VirtualEnvForNewerDjango上的说明进行操作,并创建了一个virtualenv安装了1.9的程序.但是,当我尝试运行我的应用程序时,我收到错误ImportError: No module named myapp.settings

这是我的 username_pythonanywhere_com_wsgi.py

import os
import sys

# add your project directory to the sys.path
project_home = u'/home/rhpt'
if project_home not in sys.path:
    sys.path.append(project_home)

# set environment variable to tell django where your settings.py is
os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'

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

我也尝试过myapp.my_app.settings没有成功.

我的树

myapp                                                                                                                                 
??? my_app                                                                                                                            
?   ??? __init__.py                                                                                                                        
?   ??? settings.py                                                                                                                        
?   ??? urls.py                                                                                                                            
?   ??? wsgi.py                                                                                                                            
??? get_data …
Run Code Online (Sandbox Code Playgroud)

pythonanywhere

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

散景+交互式小部件+ PythonAnywhere

我找不到使用在PythonAnywhere上运行的bokeh和bokeh小部件的交互式Web应用程序的最小工作示例。

理想情况下,我希望有一个相对复杂的函数的简单图解(我从分析上不知道,但是我有SymPy为我计算),当参数更改时应重新绘制。

到目前为止,我发现的所有代码都没有做到这一点,例如https://github.com/bokeh/bokeh/tree/master/examples,或者引用了过时的bokeh版本。

大多数文档都涉及运行bokeh服务器,但是没有指示如何使用WSGI来运行它(这是PythonAnywhere处理请求的方式)。由于这个原因,我尝试在Flask应用程序中嵌入Bokeh图。但是,据我所知,为了具有交互式Bokeh小部件(应在Python中触发一些计算),确实需要bokeh服务器。如果我可以使用其他一些简单的工具获得相似的结果,则我对使用Flask或Bokeh并不特别感兴趣。不幸的是,带有交互式窗口小部件的Jupyter笔记本在PythonAnywhere中似乎不是一个选项。

我已经在Python 3.5上安装了bokeh 0.12。

我设法在flask应用程序中运行了一个简单的散景图,但是我无法使用Bokeh小部件。

python pythonanywhere bokeh

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