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脚本的网站!