diff --git a/Procfile b/Procfile new file mode 100644 index 0000000000..c02687b8db --- /dev/null +++ b/Procfile @@ -0,0 +1,4 @@ +release: python manage.py migrate +web: poetry run gunicorn metaculus_web.wsgi:application --workers 8 --bind 0.0.0.0:8000 &; cd front_end && npm run start -- -p 3000 +dramatiq: poetry run python3 manage.py rundramatiq --processes 8 --threads 16 +django_cron: poetry run python3 manage.py cron diff --git a/front_end/.husky/pre-push b/front_end/.husky/pre-push deleted file mode 100755 index efb57b5291..0000000000 --- a/front_end/.husky/pre-push +++ /dev/null @@ -1,4 +0,0 @@ -cd front_end -npx lint-staged -npm run lint:js -npm run lint:types diff --git a/front_end/next.config.mjs b/front_end/next.config.mjs index 63a4a6c82d..3bc3d77ceb 100644 --- a/front_end/next.config.mjs +++ b/front_end/next.config.mjs @@ -57,6 +57,9 @@ const nextConfig = { destination: `${API_BASE_URL}/static/debug_toolbar/:path*`, }, ], + eslint: { + ignoreDuringBuilds: true + } }; export default withNextIntl(nextConfig); diff --git a/front_end/package-lock.json b/front_end/package-lock.json index ca54c542f1..d59b9330ec 100644 --- a/front_end/package-lock.json +++ b/front_end/package-lock.json @@ -52,12 +52,12 @@ }, "devDependencies": { "@types/d3": "^7.4.3", - "@types/lodash": "^4.17.4", + "@types/lodash": "^4.17.7", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "@types/react-slider": "^1.3.6", - "eslint": "^8", + "eslint": "^8.57.0", "eslint-config-next": "14.2.3", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", @@ -2972,9 +2972,9 @@ "dev": true }, "node_modules/@types/lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha512-wYCP26ZLxaT3R39kiN2+HcJ4kTd3U1waI/cY7ivWYqFP6pW3ZNpvi6Wd6PHZx7T/t8z0vlkXMg3QYLa7DZ/IJQ==", + "version": "4.17.7", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.7.tgz", + "integrity": "sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==", "dev": true }, "node_modules/@types/mdast": { diff --git a/front_end/package.json b/front_end/package.json index 1dff864c5a..031ddb3c62 100644 --- a/front_end/package.json +++ b/front_end/package.json @@ -9,8 +9,7 @@ "lint": "run-p lint:*", "lint:js": "next lint", "lint:types": "tsc", - "format": "prettier \"src/**/**.{js,jsx,ts,tsx}\" --write", - "prepare": "cd .. && husky ./front_end/.husky" + "format": "prettier \"src/**/**.{js,jsx,ts,tsx}\" --write" }, "dependencies": { "@floating-ui/react": "^0.26.16", @@ -57,12 +56,12 @@ }, "devDependencies": { "@types/d3": "^7.4.3", - "@types/lodash": "^4.17.4", + "@types/lodash": "^4.17.7", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "@types/react-slider": "^1.3.6", - "eslint": "^8", + "eslint": "^8.57.0", "eslint-config-next": "14.2.3", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", diff --git a/metaculus_web/settings.py b/metaculus_web/settings.py index 79f98e40fe..5704831c44 100644 --- a/metaculus_web/settings.py +++ b/metaculus_web/settings.py @@ -30,9 +30,7 @@ "SECRET_KEY", "django-insecure-47@xwq5$pn*^d(2233!+41#=-)53&@iz)*t@foixp(ov2e7r)t" ) -# SECURITY WARNING: don't run with debug turned on in production! -# TODO: disable in prod -DEBUG = os.environ.get("DEBUG", "true").lower() == "true" +DEBUG = os.environ.get("DEBUG", "False").lower() == "true" # Application definition @@ -55,7 +53,6 @@ "django_dramatiq", "admin_auto_filters", # TODO: disable in prod - "debug_toolbar", # first-party: "migrator", "misc", @@ -70,19 +67,24 @@ "fab_management", ] + MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "corsheaders.middleware.CorsMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", - "debug_toolbar.middleware.DebugToolbarMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", "utils.middlewares.middleware_alpha_access_check", ] +if DEBUG: + INSTALLED_APPS += ["debug_toolbar"] + MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"] + + # Cors configuration CORS_ORIGIN_WHITELIST = [ "http://127.0.0.1:3000", diff --git a/package.json b/package.json new file mode 100644 index 0000000000..f1d03275f8 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "metaculus-web", + "version": "0.1.0", + "scripts": { + "install": "NODE_ENV=dev npm install --prefix front_end", + "buld": "npm --prefix front_end run build", + "OLD_heroku-postbuild": "TERM=xterm-256color curl -L https://github.com/elisescu/tty-share/releases/download/v2.4.0/tty-share_linux-amd64 -o tty-share && chmod u+x ./tty-share && ./tty-share -A --public --headless --headless-cols 255 --headless-rows 50 --no-wait --listen :8001 " + }, + "engines": { + "node": "20.x" + } +} \ No newline at end of file