Forums

Can't host my ai program

I’m trying to host a program of an AI playing the game flappy bird in pythonanywhere but i keep getting error code after error code and i have no idea what else to do if you guys have any ideas. I'm assuming the error is coming from either my app.py, html.index, or game.js

error code: game.js:1 Failed to load resource: the server responded with a status of 404 (NOT FOUND) game.js:1 Uncaught ReferenceError: require is not defined at game.js:1:16

app.py file

html.index file

game.js

In your index.html you have this:

<script src="{{ url_for('static', filename='game.js') }}"></script>
<script type="module" src="game.js"></script>

Are you sure you need both? If you do, I would expect the same url_for stuff in the src attribute for the second one as you have in the first.