PyJaipur / PyJudge

Simple Programming Contest hosting software
MIT License
17 stars 29 forks source link

Serving static files #81

Closed HeroicHitesh closed 5 years ago

HeroicHitesh commented 5 years ago

Thank You for your contribution to the PyJudge

HeroicHitesh commented 5 years ago

you will also have to move the existing css and JS files to a single folder and make changes in HTML so that they use this URL.

We don't have JS files and HTML files are already served https://github.com/PyJaipur/PyJudge/blob/cfc8826c194a9df2e6da4fd27085a1ec4969cf9e/server.py#L29-L32 screenshot 387

theSage21 commented 5 years ago

The index.html file requires css files. Usually people will include some sort of JS file also. Keeping that in mind, we can create a folder called static and move the css folder inside that. Then we can simply serve the contents of the folder, be it css or javascript.

theSage21 commented 5 years ago

Yes you are right. Although it will not create a folder. That has to be done manually

On Sat 9 Feb, 2019, 11:39 HeroicHitesh <notifications@github.com wrote:

@HeroicHitesh commented on this pull request.

In server.py https://github.com/PyJaipur/PyJudge/pull/81#discussion_r255289208:

@@ -37,6 +37,11 @@ def download(path): return static_file(path, root=question_dir)

+@route('/static/') +def server_static(filepath):

  • return static_file(filepath, root='PyJudge/css')

So it means that root=os.path.join(dir_path, 'static') will create a folder called static inside dir_path which already present for our project and then when we need JS files we can create subfolder js inside folder static. Am I right?

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/PyJaipur/PyJudge/pull/81#discussion_r255289208, or mute the thread https://github.com/notifications/unsubscribe-auth/AHVj0WQGORH2vDnhU05gv5zJD-7IW8A7ks5vLmYigaJpZM4awF6F .