如何将图像或任何其他文件上传到www.pythonanywhere.com等在线服务器或django中的任何其他服务器?通过python脚本

时间:2016-08-12 06:49:45

标签: python django image upload backend

Models.py

from django.db import models


class Stock(models.Model):
    ticker = models.CharField(max_length=10)
    open = models.FloatField()
    close = models.FloatField()
    volume = models.IntegerField()
    image = models.ImageField(upload_to=r'geeky.pythonanywhere.com/files', max_length=254,default="https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRvj-aG0r4GBOQbne5fKQxoPdozZr81YZjrgM1etERa4RHWkvBOsw")

    def __str__(self):
        return self.ticker

这里geeky是我的用户名,pythonanywhere是我的服务器帐户用于运行python脚本的网站!

0 个答案:

没有答案