CSI-280 / MusicGames

0 stars 0 forks source link

Set Up Github Pages for easier site testing #22

Open NaomiHoniker opened 4 years ago

NaomiHoniker commented 4 years ago

This might be either a big issue or a small one, depending on how we want to do this. I've found that Github pages works really well for easily hosting web stuff on github, and I've already checked the box in the settings that gets it ready to be opened as a Pages site. Only problem is that for Pages to work, we need to have our home page be titled "index.html" (which it is), and (I believe) for index.html to be put in the root of the repository, not inside of a folder. We can either move it to root or attempt one of the fixes in this stackoverflow thread.

If you look in the settings page, the Pages section is also showing this warning:

Your site is having problems building: The symbolic link /backend/env/Scripts/_asyncio.pyd targets a file which does not exist within your site's repository.

Anyone who set up the back-end stuff know what this could mean?

A-Waters commented 4 years ago

The reason this isn't going to work is because of two reasons. As far as I know, GitHub pages don't support react based projects (someone correct me if I'm wrong), Theoretically, we could host the backend of the project on a separate computer but then we would require that to be up and running 24/7 (since GitHub pages would be up 24/7) instead of locally.

NaomiHoniker commented 4 years ago

I found this, as far as building Pages with React goes. I'll look more into it, but I'm not super knowledgeable on React stuff just yet.

A-Waters commented 4 years ago

I remember trying to do something similar (maybe the same) to this in the previous project and I couldn't get it working. I'm not sure if I was doing it wrong or what. I encourage anyone to give it a shot tho.

chrisbendel commented 4 years ago

I can confirm i've deployed a react project using github pages

also i've had good experiences in the past with heroku for a free backend - https://www.heroku.com/free

A-Waters commented 4 years ago

@chrisbendel do you know if this is the way to go? And if not can you point us in the right way?

chrisbendel commented 4 years ago

@TAwc any tutorial will probably get you where you need to be, i personally used this as a template a while back https://github.com/gitname/react-gh-pages

JakeCapra commented 4 years ago

What's going on with this issue? It's been here for a while. Any progress? I've used git hub pages before with react, so I can take over if you'd like. @RichardHoniker @TAwc

A-Waters commented 4 years ago

I haven't tried adding it to github pages, but logicly im not sure its the way to go...

JakeCapra commented 4 years ago

I guess. I mean it would make it easier to show people our site. I don't think that database would work though.@TAwc

A-Waters commented 4 years ago

agreed. we would need to modify the site for basically production level code... and I'm not sure we are at that level yet. @JakeCapra

JakeCapra commented 4 years ago

unless..... we just create a server. I have some spare laptops lying around. If we can figure out how to do it, I would donate one of my laptops to the cause. @TAwc . Also, it doesn't need to be "production level", you know, this is just a fun school project, not like we have people relying on this site. If it breaks it breaks.

chrisbendel commented 4 years ago

Free hosting sites are also a thing, heroku is one option that i've used in the past

JakeCapra commented 4 years ago

I was talking more about the database unless those hosting sites also handle that. @chrisbendel

chrisbendel commented 4 years ago

https://www.heroku.com/python looks like they support django databases. You'd need to do a little digging but im assuming that would be an option on the free tier

A-Waters commented 4 years ago

No, I just mean like security issues, for example, CORS. Currently, we don't have them fully working and I don't know the extent of the damage someone could do without it. @JakeCapra

chrisbendel commented 4 years ago

You should be able to get around CORS issues with something like this on your django backend:

http://www.srikanthtechnologies.com/blog/python/enable_cors_for_django.aspx

specifically you'd whitelist certain domains such as your localhost (when developing locally) as well as your deployed frontend domain


CORS_ORIGIN_ALLOW_ALL = False
CORS_ORIGIN_WHITELIST = (
       'http://localhost:4200',
)

or you can yolo and just allow_all = True