Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
VGSources
Blog

How to Reset the Django Admin Password on a VPS

Use Django’s changepassword command from the live VPS environment, or set a custom user’s password with get_user_model() and set_password(). Verify the production database, account status, and admin login path if access still fails.
Length12 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The supported way to reset a Django admin password over SSH is to run Django’s changepassword management command from the deployed project directory, using the same virtual environment, settings, and database as the live site. Django asks for the replacement password twice and stores only its encoded hash. If the username is unknown or the project uses a custom user model, use manage.py shell with get_user_model() and set_password() instead.

Choose the right recovery method

Your choice depends on what you know about the account and how the project is configured. The commands below must run against the database used by the live VPS deployment, not a development checkout or a different settings module.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Situation Use Why
You know the account identifier used by the project changepassword Shortest supported, interactive reset
The project logs in with an email address, uses a custom user model, or needs a nonstandard lookup Django shell with get_user_model() Lets you query the configured model and call set_password()
The original privileged account no longer exists createsuperuser Creates a new account with all permissions
The live data is in a non-default configured database Either method plus --database <alias> where supported Targets the intended database connection explicitly

Django’s authentication commands require django.contrib.auth to be installed. A project can also change the login identifier, required fields, admin URL, and access rules, so verify those details in the project configuration.

Check the deployment before changing anything

A password reset is only useful if it modifies the same user row that the running application reads. Before invoking Django, identify the live application’s working directory, interpreter, settings selection, and database environment.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Find the live project directory

SSH to the VPS with an account that can read and execute the deployed application. Change into the directory containing the production manage.py. Common layouts place it under a release directory, an application user’s home directory, or a path referenced by a process manager, but there is no universal VPS path. Do not assume that a similarly named checkout in your home directory is the one serving traffic.

Use the production Python environment

Activate the virtual environment used by the web process, or call that environment’s interpreter directly. Running the system Python can select a different Django version, omit project dependencies, or load a different configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
source /path/to/venv/bin/activate

If activation is not appropriate for the deployment, use an explicit interpreter path instead:

/path/to/venv/bin/python manage.py <command>

Preserve the live settings and environment variables

Use the same environment variables and settings-selection mechanism as the running service. A command launched without the production DJANGO_SETTINGS_MODULE, secret configuration, or database variables may fail to start or silently point at a development SQLite file. If the service uses a wrapper script, process-manager configuration, or an .env loader, follow that deployment’s normal invocation method.

Determine the database alias

Django uses the default database alias unless another alias is selected. If the project defines several databases, establish which alias contains the live user records before resetting the password. The command-line option is an alias name configured in DATABASES, not a hostname, schema name, or shell variable.

Reset a known account with changepassword

Once you are in the live project directory with the correct interpreter and settings, run the command with the account identifier expected by the project:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Start an SSH session using the deployment account.
  2. Change to the directory containing the live manage.py.
  3. Activate the production virtual environment, or use its Python executable directly.
  4. Run python manage.py changepassword <username>, replacing the placeholder with the account’s actual login identifier.
  5. Enter the new password at both prompts. Django applies it only when the two entries match.
  6. Exit the SSH session or continue with the verification checks below.

The identifier is normally the user’s username, but projects can configure a different USERNAME_FIELD, such as an email address. Supply the value the authentication backend expects; do not automatically substitute an email address unless the project uses it as the login field.

Select a non-default database

If the account lives in another configured database, add the database alias to the command:

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
python manage.py changepassword <username> --database <alias>

Without this option, Django uses the default alias. A successful command against the wrong alias can still change a user record while leaving the live site unchanged, so check the deployment’s database routing and environment first.

What success and failure look like

Django prompts for a new password twice and reports an error if the values do not match or the account cannot be found. A missing-account error usually means the identifier is wrong, the custom user model has a different lookup field, or the command connected to the wrong database. Stop and correct the target rather than trying several similar accounts blindly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run the command noninteractively only with care

The normal command is interactive by design, which keeps the replacement password out of the command line. Avoid inventing a one-line workaround that places the password in process arguments or shell history. If an automated recovery is required, use the project’s approved secret-handling mechanism and the shell-based set_password() approach, then remove temporary credentials under the team’s policy.

Why Django asks twice and stores a hash

Django does not store a clear-text password on the user model. It stores an encoded password hash, so an administrator cannot retrieve the original value from the database. The supported helpers perform the hashing and preserve the algorithm metadata needed for later verification.

The changepassword and createsuperuser commands apply validators configured in AUTH_PASSWORD_VALIDATORS by default. A validator can reject a password that is too short, too common, or too similar to user information. Validators do not automatically run merely because a model is saved, which is another reason to use Django’s command or password helper instead of writing directly to the field.

Use the Django shell when the username is uncertain

The shell is useful for an email lookup, a custom user model, a scripted recovery, or an account whose identifier is not known. Start it from the same live directory, environment, settings, and database context used for the normal command:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
python manage.py shell

Then query the configured user model and call set_password():

from django.contrib.auth import get_user_model

User = get_user_model()
user = User.objects.get(email='[email protected]')
user.set_password('use-a-new-unique-password')
user.save(update_fields=['password'])

Adapt the lookup to the project. You might use a username, primary key, or another field, but the query should uniquely identify one intended account. If it returns multiple rows, refine the filter; if it returns none, verify the database alias and the field used for authentication.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Never assign a raw password

Do not write a plain string directly to user.password. That bypasses Django’s hashing format and can make authentication fail or expose the credential in the database. set_password() performs the supported encoding step before the row is saved.

Avoid leaking the replacement password

The example uses a literal only to show the method. Do not paste a real production password into shell history, a deployment script, a ticket, or source control. For a one-off recovery, type it interactively in a controlled session or use your team’s approved secret-handling procedure, then remove any temporary material according to that policy.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Applying the change to another database

The shell itself does not magically select a different database for every query. Start Django with the deployment’s normal database configuration, and use the project’s database routing or an explicit connection/manager choice if the user model is stored outside default. Confirm the resulting row is in the database read by the live application before testing the browser login.

Check the result without exposing the password

After saving, you can inspect nonsecret account fields such as the user’s identifier, active flag, and staff flag. Do not print the password field or copy the encoded hash into a ticket. The useful confirmation is that the intended row was updated and that the live application can authenticate it, not that a particular hash string appears in terminal output.

Create a replacement superuser if the account is gone

If the original administrator does not exist, create a new privileged account with:

python manage.py createsuperuser

The interactive command asks for the identity fields required by the configured user model and a password. The resulting account is created with all permissions. Use the same production interpreter, settings, and database checks as for a password reset, and confirm any custom required fields before starting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Creating a second account is different from changing an existing one. It leaves the old row untouched, so investigate duplicate access and remove or disable an obsolete account only through the project’s approved administrative process.

If the command says the proposed identifier is already in use, that is evidence that an account exists rather than a reason to create another similar record. Identify the existing row and reset it with changepassword or set_password(). If the custom model requires additional fields, provide exactly those fields when prompted instead of assuming Django’s default username form.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

If the new password still fails on the admin page

A successful command does not prove that the browser is authenticating against the same account or database. Work through these checks in order.

1. Confirm the target database

Check the database alias, connection variables, and settings module used by the command against those used by the running web process. A common failure is resetting a local SQLite file or a staging database while the public site reads PostgreSQL or another production connection.

2. Confirm the account and login field

Use the configured user model to verify the account’s identifier, email, and primary key. A custom model may authenticate by email, and a project can have several users with similar display names. Ensure the reset affected the exact row selected by the login backend.

3. Check active and staff status

Most admin access rules require the account to be active and to have staff access; projects can impose additional permissions. Resetting a password does not automatically change is_active, is_staff, group membership, or custom authorization flags. Inspect those fields in the project’s normal administrative workflow and correct them only if the account should have that access.

4. Verify the admin URL and authentication flow

The admin may be mounted at a custom path rather than /admin/, and a project may use a custom login view or single-sign-on layer. Confirm the URL and authentication route configured by the live application instead of assuming Django’s default.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Check deployment state

Changing a database password normally does not require a universal VPS restart command. However, a deployment can have stale workers, multiple application instances, or configuration loaded only at process startup. Follow the project’s established reload or restart procedure for its process manager and reverse proxy; Django does not define one command that is correct for every VPS.

6. Rule out browser session confusion

Use a private browsing window or clear the site’s cookies to eliminate a stale login session. This does not repair an incorrect password, but it distinguishes an old session or redirect loop from an authentication failure. If a custom password-change view changed another user’s password, session invalidation follows that project’s authentication setup; do not assume every deployment handles sessions identically.

7. Read the application logs

Inspect the web process and application logs using the deployment’s normal tools. Look for messages about an unknown user, inactive account, database connection, custom authentication backend, or CSRF and proxy configuration. Avoid pasting passwords or session cookies into logs or support tickets.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Operational security after the reset

  • Choose a long, unique password that is not reused on the VPS, hosting account, or another service.
  • Keep the SSH terminal private while entering both prompts.
  • Do not place a production password in command-line arguments, shell history, source control, or a temporary script.
  • Remove temporary credentials and history entries according to the shell and VPS team’s documented policy.
  • Review who has shell access and who can run management commands, because anyone with equivalent access can repeat the reset.
  • After regaining access, review admin users, staff flags, groups, and recent authentication activity for unexpected changes.

Practical decision checklist

Use this short checklist before closing the SSH session:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • The command ran from the directory containing the live manage.py.
  • The interpreter and virtual environment match the running deployment.
  • The production settings and environment variables were loaded.
  • The database alias was verified; default was used only when it is the live connection.
  • The account identifier matches the configured user model and authentication field.
  • The new password was entered identically at both prompts or applied with set_password().
  • The account is active and has the staff access required by this project.
  • The admin URL and login flow are the ones served by the live site.
  • No password was left in history, source code, logs, or a shared transcript.

Common mistakes to avoid

  • Running from the wrong checkout: two directories can contain different migrations, settings, or databases. Locate the directory referenced by the live service rather than relying on its name.
  • Using the wrong Python executable: a system interpreter may not have the project’s Django installation or environment variables. Match the web process’s interpreter.
  • Passing a hostname instead of an alias: --database expects a configured Django alias such as default or another project-defined name.
  • Guessing the login identifier: a display name, email address, and username are not interchangeable unless the configured authentication model says they are.
  • Editing the database directly: direct SQL or a raw assignment can bypass Django’s password encoding and validation behavior. Use the management command or set_password().
  • Assuming a restart fixes authentication: a restart cannot correct a password written to the wrong database or an account without staff access.

When to stop and involve the deployment owner

Pause instead of experimenting if you cannot establish which process serves the site, which database contains the users, or which account should be changed. A reset against an unknown environment can lock out the intended administrator or create an additional privileged account. Ask the deployment owner for the canonical working directory, settings invocation, database alias, user identifier, and approved reload procedure. Record only nonsecret operational details; never request or transmit the existing or replacement password.

Frequently Asked Questions

What is the exact Django command to reset an admin password?

From the live project directory, run python manage.py changepassword <username>. Enter the replacement password twice. Use the production virtual environment, settings, and database connection.

How do I reset a password when the project uses email login?

If the email is the configured login field, use it as the identifier with changepassword. If the command cannot find the account, open python manage.py shell, load get_user_model(), query the unique email, call set_password(), and save the user.

How do I target a second Django database?

For changepassword, append --database <alias>. The alias must be one configured in DATABASES; without it Django uses default. For shell-based changes, start Django with the live database configuration and follow the project’s routing rules.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does Django say the user does not exist?

The identifier may be wrong, the custom user model may use another field, or the command may be connected to the wrong settings module or database. Verify the live environment and query the configured user model before trying another account.

Why can I authenticate but not open the admin?

Resetting a password does not set authorization flags. Check that the intended account is active, has the staff access required by the project, and is using the correct admin URL and authentication flow.

Do I need to restart Gunicorn, uWSGI, or another VPS service?

There is no universal Django restart command for every VPS. A password row change is normally read from the database, but follow the deployment’s established reload procedure if its workers or configuration require it.

Can I set user.password directly?

No. Django stores an encoded hash, not clear text. Call user.set_password(new_password) and save the object so the password has the format Django’s authentication system expects.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What if the original superuser was deleted?

Run python manage.py createsuperuser in the live environment. It creates a new account with all permissions. Confirm the custom user model’s required fields and database first, and review whether an obsolete account should later be disabled.

The Bottom Line

Use changepassword from the live Django deployment whenever you know the account identifier. For custom lookups, use get_user_model() and set_password(); use createsuperuser only when the original account is absent. If access still fails, verify the database, settings, user status, login field, admin URL, and deployment-specific authentication flow before making another change.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.