当我运行tox命令Sphinx为我的 Python 项目生成文档时遇到问题。这是错误:
docs runtests: PYTHONHASHSEED='1181019260'
docs runtests: commands[0] | sphinx-build -W -b html -c ./conf.py -d /Users/rakesh.kumar/ll/client-location/limekiln/.tox/docs/tmp/doctrees . /Users/rakesh.kumar/ll/client-location/limekiln/.tox/docs/tmp/html
Error: Config directory doesn't contain a conf.py file.
ERROR: InvocationError: '/Users/rakesh.kumar/ll/client-location/limekiln/.tox/docs/bin/sphinx-build -W -b html -c ./conf.py -d /Users/rakesh.kumar/ll/client-location/limekiln/.tox/docs/tmp/doctrees . /Users/rakesh.kumar/ll/client-location/limekiln/.tox/docs/tmp/html'
_________________________________________________ summary __________________________________________________
py27: commands succeeded
lint: commands succeeded
ERROR: docs: commands failed
Run Code Online (Sandbox Code Playgroud)
它基本上是在抱怨conf.py,但是这个配置文件存在于存在的同一目录中tox.ini。我是新来的tox和sphinx不知道为什么它抱怨。这里是内容tox.ini。
[tox]
envlist = py27,lint,docs
[testenv]
commands =
python setup.py nosetests --with-coverage --cover-package=limekiln …Run Code Online (Sandbox Code Playgroud) 我正在使用Square Retrofit版本2.0 beta2.我试过按照本教程.我试图将位图图像上传到服务器,但不知何故代码不起作用.我尝试使用邮递员测试我的服务器,我能够发布照片甚至能够检索它.这是我的烧瓶控制器.
@app.route('/api/photo/user/<int:user_id>', methods=["POST"])
def post_user_photo(user_id):
app.logger.info("post_user_photo=> user_id:{}, photo: {}".format(
user_id,
request.files['photo'].filename,
))
user = User.query.get_or_404(user_id)
try:
user.photo = request.files['photo'].read()
except Exception as e:
app.logger.exception(e)
db.session.rollback()
raise
db.session.commit()
return "", codes.no_content
Run Code Online (Sandbox Code Playgroud)
我用邮递员来测试我的控制器,这是邮递员生成的请求.
POST /api/photo/user/5 HTTP/1.1
Host: blooming-cliffs-9672.herokuapp.com
Cache-Control: no-cache
Postman-Token: 8117fb79-4781-449d-7d22-237c49b53389
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="photo"; filename="sfsu.jpg"
Content-Type: image/jpeg
----WebKitFormBoundary7MA4YWxkTrZu0gW
Run Code Online (Sandbox Code Playgroud)
我已经定义了改造服务和上传图像,这是我的Android代码.接口部分
@Multipart
@POST("/api/photo/user/{userId}")
Call<Void> uploadUserProfilePhoto(@Path("userId") Integer userId, @Part("photo") RequestBody photo);
Run Code Online (Sandbox Code Playgroud)
客户端构建器部分
public static BeamItService getService(){
if (service == null) {
OkHttpClient client = new OkHttpClient(); …Run Code Online (Sandbox Code Playgroud) 我正在编写一个应用程序来存储用户个人资料信息和联系信息。用户个人资料和联系信息也有图像/位图。我想可能将图像存储在内部存储器中并使用Picasso库显示图像。我想应用程序创建一个配置文件目录来存储配置文件图像和类似的联系人。我想用来Picasso从文件中检索图像并将其显示在 ImvageView 上,如下所示。
Picasso.with(context)
.placeholder(R.drawable.user_placeholder)
.error(R.drawable.user_placeholder_error)
.load("file:///somepath/profile.png")
.into(imageView);
Run Code Online (Sandbox Code Playgroud)
我不确定应用程序将如何创建子目录并存储图像。可以提供Picasso给加载图像的图像的路径是什么Imageview?
编辑1
我想,我可以getApplicationContext().getFilesDir().getAbsolutePath()用来获取路径,但我仍然不确定如何为个人资料和联系人创建子目录?