Setting up a Django admin
Hello, I am a member of the following website.
I am Japanese.
Sorry if my English is not good.
https://railway.app/template/GB6Eki
This is a Railway template that allows you to deploy "Django".
I have deployed it, but I don't know the initial login name and password to enter when I go to the ADMIN page.
I think I need to set up a SUPERUSER.
I executed the following command, but got an "ERR" error.
railway run python manage.py createsuperuser
-- ERR --
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
----------
I haven't edited any code.
Can you tell me how to set up an admin?
Solution:Jump to solution
Hello, I am a member of the following website.
I am Japanese.
Sorry if my English is not good.
https://railway.app/template/GB6Eki...
24 Replies
Project ID:
N/A
with N/A
You will need to have the Railway CLI installed on your computer.
You will want to follow the steps below to make it work
1) Login to Railway CLI
2) Clone the repo to local
3)
pip install -r requirements.txt
the project dependencies
4) railway link
then select your project
5) railway service
to select the service
6) railway shell
to inject your service environment variables to your shell
7) railway run python manage.py createsuperuser
<- to create your super user
Or you can manually set all the environment variables on your virtual environment to match the ones on your django service. The choice is yoursThanks for the reply.
I have railway CLI installed.
"railway link " succeeds, but the "railway shell" fails.
[ result ]
No service linked, not entering shell.
I added a few missing steps. Try the above one more time in order
Thank you very much.
I tried running it with the modified steps and got an error.
Am I doing something wrong?
It looks like you don't have django installed.
did you do
pip install -r requirements.txt
?
If you work on multiple python projects on your system, you should be using virtual environments for each projectI see that is says you're missing pg_config
Okay, I see what happened... Because you don't have postgres installed on your local system, it can't install postgres, and the
pip install
failed at the pg
packageYes, we did.
I am getting an error "error: subprocess-exited-with-error", is this relevant?
Windows
Powershell
Look at the prompt brody! 🤣
we are both blind
https://www.postgresql.org/download/windows/
Yeah, tell me about it! 🤣
Once you have postgres installed, you will want to run the steps again from step 3
That way it will pick up your postgres config
Thank you very much.
I ran from step3 after installation but got another error.
I will translate Japanese.
"指定されたモジュールが見つかりません。"
↓
"The specified module cannot be found."
That is a weird error considering, the psycopg2 package installed successfully this time.
would it be worth a log off and log back on? what do you think vin
That's a good try, and if that doesn't work, try doing
pip install postgres
it should install the psycopg2 and psycopg2-binary again just in caseThank you!
I succeeded!
I rebooted and it failed.
I ran "pip install postgres" and it succeeded.
Thank you!
Thank you very much!
fun fact, don't run railway up
No, you do not want to run railway up... That will mess things up for you
you shouldn't even need to reboot or redoploy your service, that command just inserts data into the database, you should be able to go login right away
In order to deploy the original Django web app, we needed to deploy a template.
Now I will be able to develop my own web app.
Thank you very much.
yep that's the beauty of templates