小编Ale*_*yer的帖子

运行Google"Hello Analytics"API教程时,如何避免此X-Frame-Options SAMEORIGIN错误?

我一直在尝试运行https://developers.google.com/analytics/solutions/articles/hello-analytics-api教程来启动并运行从Google Analytics以编程方式提取数据.

我已经完全复制了示例文件,但是当我通过Chrome中的localhost访问它们时,我在JavaScript控制台中收到以下错误,并被重定向到about:blank:

Refused to display 'https://accounts.google.com/o/oauth2/auth?client_id=363192057646-fbj7q1oais...%2Flocalhost&response_type=token&state=327475409%7C0.2024869166&authuser=0' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
Run Code Online (Sandbox Code Playgroud)

我已经尝试过所有方式的调整,但不能让这个错误消失.希望有人可以提供帮助(或者实际上只是指导我使用一个简单,有效的Javascript示例来访问Google AnalyticsAPI.

javascript api google-analytics

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

Django:具有多个子模型类型的父模型

我为CMS创建了一组Django模型来显示一系列Products.

每个页面都包含一系列行,所以我有一个泛型

class ProductRow(models.Model):
  slug = models.SlugField(max_length=100, null=False, blank=False, unique=True, primary_key=True)
  name = models.CharField(max_length=200,null=False,blank=False,unique=True)
  active = models.BooleanField(default=True, null=False, blank=False)
Run Code Online (Sandbox Code Playgroud)

对于不同类型的行,我有一系列这个模型的孩子:

class ProductBanner(ProductRow):
  wide_image = models.ImageField(upload_to='product_images/banners/', max_length=100, null=False, blank=False)
  top_heading_text = models.CharField(max_length=100, null=False, blank=False)
  main_heading_text = models.CharField(max_length=200, null=False, blank=False)
  ...

class ProductMagazineRow(ProductRow):
  title = models.CharField(max_length=50, null=False, blank=False)
  show_descriptions = models.BooleanField(null=False, blank=False, default=False)
  panel_1_product = models.ForeignKey(Product, related_name='+', null=False, blank=False)
  panel_2_product = models.ForeignKey(Product, related_name='+', null=False, blank=False)
  panel_3_product = models.ForeignKey(Product, related_name='+', null=False, blank=False)
  ...

class ProductTextGridRow(ProductRow):
  title = models.CharField(max_length=50, null=False, blank=False)
  col1_title …
Run Code Online (Sandbox Code Playgroud)

python django inheritance model

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

标签 统计

api ×1

django ×1

google-analytics ×1

inheritance ×1

javascript ×1

model ×1

python ×1