Skip to content

Commit

Permalink
WIP ensure webtrends.min.js is deployed to file storage
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcrees committed Sep 13, 2018
1 parent 76ebc56 commit b174f80
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ FROM phedct/oneyou-cms:mssql-python-nodejs
WORKDIR /code
ADD . /code

RUN npm install --prefix frontend/website-client \
RUN rm -rf frontend/website-client/node_modules \
&& npm install --prefix frontend/website-client \
&& npm run build --prefix frontend/website-client \
&& cp -R frontend/website-client/build oneYou2/web \
&& rm -rf frontend/website-client/node_modules \
Expand Down
7 changes: 6 additions & 1 deletion oneYou2/frontendHandler/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ def get_css_for_version(cls, version_id, file_name):

@classmethod
def load_static(cls, path, file_name):
print(path, file_name)
print("load_static, path is %s, file is %s" % (path, file_name))
file_service = FileService(account_name=settings.AZURE_ACCOUNT_NAME, account_key=settings.AZURE_ACCOUNT_KEY)
file_directory = settings.ENV if settings.ENV != 'local' else 'dev'
directory_name = file_directory + '/' + path
print("load_static, get_file dir %s, file %s to ./web" % (directory_name, file_name))
return file_service.get_file_to_path(settings.AZURE_FILE_SHARE, directory_name, file_name, './web/' + file_name)

@classmethod
Expand Down Expand Up @@ -154,6 +155,10 @@ def deploy_version(cls):
file_service.put_file_from_path(settings.AZURE_FILE_SHARE, version_directory, 'favicon.ico',
'./web/favicon.ico')

print('uploading webtrends.min.js')
file_service.put_file_from_path(settings.AZURE_FILE_SHARE, version_directory, 'webtrends.min.js',
'./web/webtrends.min.js')

release_tag = get_release_version()
print('adding tag meta to the version directory')
file_service.put_file_from_text(settings.AZURE_FILE_SHARE, version_directory, 'tag.txt', release_tag)
Expand Down
2 changes: 2 additions & 0 deletions oneYou2/release/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ def cms_statics(request, path):


def web_statics(request, site_name, path):
print("Serving web static %s" % path)
return serve(request, path, document_root='./web/static/')


def statics(request, site_name, path):
print("Serving static %s" % path)
path_components = path.split('/')
file_name = path_components.pop()
FrontendVersion.load_static('/'.join(path_components), file_name)
Expand Down

0 comments on commit b174f80

Please sign in to comment.