bin目录的文件:
#client #-*- Coding:utf-8 -*- import os,sys BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) #获取该项目根目录的完整路径 sys.path.append(BASE_DIR) from core import ftp_client fc = ftp_client.Ftp_client() start_client.py
#server #-*- Coding:utf-8 -*- import os,sys BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(BASE_DIR) from core import ftp_server fs = ftp_server.Ftp_server() start_server.py
conf目录下
#setting #-*- Coding:utf-8 -*- import os,sys,socket BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(BASE_DIR) #注意这个方法是在程序运行的时候起作用,无法保存。 #IP和端口信息 IP_PORT = ("localhost",6969) #用户数据文件 USER_FILE = os.path.join(BASE_DIR,'db\user_info') #用户文件目录 USER_HOME = BASE_DIR setting.py
#-*- Coding:utf-8 -*- import sys,os,socket,hashlib,time,json from conf import setting from core import users class Ftp_client(object): ''' FTP客服端 ''' def __init__(self): ''' 构造函数 ''' self.client = setting.socket.socket() self.client.connect(setting.IP_PORT) self.help_info = """