nginx试图将我的后端作为一个静态站点

时间:2018-12-17 08:53:51

标签: nginx

我的前端是位置import pymongo import config import pandas as pd import numpy as np from datetime import datetime from config import logger client = pymongo.MongoClient(config.IP) try: client.server_info() except pymongo.errors.ServerSelectionTimeoutError as e: logger.error("Unable to connect to %s. Error: %s" % (config.IP, e)) client = None # connect to database (or create if not exists) mydb = client[config.DB_NAME] # connect to collections (or create if not exists) movie_collection = mydb[config.DB_MOVIE_COLLECTION] actors_collection = mydb[config.DB_ACTOR_COLLECTION] def read_data(file): ''' returns Dataframe with read csv data ''' df = pd.read_csv(file, sep='\t') df.replace('\\N', np.nan, inplace=True) return df def insert_to_collection(collection, data): collection.insert(data) def fill_movie_data(): ''' iterates over movie Dataframe process values and creates dict structure with specific attributes to insert into MongoDB movie collection ''' # load data to pandas Dataframe logger.info("Reading movie data to Dataframe") data = read_data('datasets/title.basics.tsv') for index, row in data.iterrows(): result_dict = {} id_ = row['tconst'] title = row['primaryTitle'] # check value of movie year (if not NaN) if not pd.isnull(row['endYear']) and not pd.isnull(row['startYear']): year = list([row['startYear'], row['endYear']]) elif not pd.isnull(row['startYear']): year = int(row['startYear']) else: year = None # check value of movie duration (if not NaN) if not pd.isnull(row['runtimeMinutes']): try: duration = int(row['runtimeMinutes']) except ValueError: duration = None else: duration = None # check value of genres (if not NaN) if not pd.isnull(row['genres']): genres = row['genres'].split(',') else: genres = None result_dict['_id'] = id_ result_dict['primary_title'] = title # if both years have values if isinstance(year, list): result_dict['year_start'] = int(year[0]) result_dict['year_end'] = int(year[1]) # if start_year has value elif year: result_dict['year'] = year if duration: result_dict['duration'] = duration if genres: result_dict['genres'] = genres insert_to_collection(movie_collection, result_dict) def fill_actors_data(): ''' iterates over actors Dataframe process values, creates dict structure with new fields to insert into MongoDB actors collection ''' logger.info("Inserting data to actors collection") # load data to pandas Dataframe logger.info("Reading actors data to Dataframe") data = read_data('datasets/name.basics.tsv') logger.info("Inserting data to actors collection") for index, row in data.iterrows(): result_dict = {} id_ = row['nconst'] name = row['primaryName'] # if no birth year and death year value if pd.isnull(row['birthYear']): yob = None alive = False # if both birth and death year have value elif not pd.isnull(row['birthYear']) and not pd.isnull(row['deathYear']): yob = int(row['birthYear']) death = int(row['deathYear']) age = death - yob alive = False # if only birth year has value else: yob = int(row['birthYear']) current_year = datetime.now().year age = current_year - yob alive = True if not pd.isnull(row['knownForTitles']): movies = row['knownForTitles'].split(',') result_dict['_id'] = id_ result_dict['name'] = name result_dict['yob'] = yob result_dict['alive'] = alive result_dict['age'] = age result_dict['movies'] = movies insert_to_collection(actors_collection, result_dict) # update movie documents with list of actors ids movie_collection.update_many({"_id": {"$in": movies}}, {"$push": { "people": id_}}) # if collections are empty, fill it with data if movie_collection.count() == 0: fill_movie_data() if actors_collection.count() == 0: fill_actors_data() 上服务的静态站点,而我的后端是位置/上的REST API。我已经配置/core/来反向代理后端,但是根据日志,它正在尝试将其用作静态站点。

nginx.conf

这是我的2018/12/17 08:47:32 [error] 6#6: *12 open() "/usr/share/nginx/html/core/v1/api/user/login" failed (2: No such file or directory)

nginx.conf

发生了什么,如何解决?

0 个答案:

没有答案