October 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 ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk11 min

How to Reset the Django Admin Password on a VPS

Use Django’s supported management commands to reset an admin password on a VPS. This guide covers SSH, virtual environments, database aliases, shell fallbacks, superuser creation, and login troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

SSH into the VPS, enter the deployed Django project, activate the same virtual environment and settings used by the live site, then run python manage.py changepassword <username>. Enter the replacement password twice. If the command changes the wrong database or the username is unknown, use Django’s shell with get_user_model() and set_password() instead.

The supported way to reset a Django admin password

Django’s built-in changepassword management command is the normal, safest route when you know the account’s username. It loads the project configuration, finds the user in the configured database, prompts for a new password twice, and saves the resulting encoded password hash when both entries match.

As an Amazon Associate I earn from qualifying purchases.

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.

The command must run in the same deployment context as the website. A command launched from the wrong directory, with a different settings module, another virtual environment, or a development database can either fail to start or successfully change an account that the public admin site never uses.

What you need before connecting

  • SSH access to the VPS with an account permitted to read and execute the deployed project.
  • The absolute or relative directory containing the live project’s manage.py.
  • The project’s production virtual environment, or the path to the Python interpreter inside it.
  • The environment variables and settings selection used by the running application.
  • The username of the existing account, unless you plan to use the shell fallback.
  • The correct database alias if the project has more than the usual default database.

Directory names, service accounts, settings modules, database credentials, process managers, and admin URL paths are deployment-specific. Do not substitute a development checkout or a local SQLite file merely because it also contains a manage.py.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Reset the password over SSH, step by step

1. Connect to the VPS

Use the SSH command and account supplied by your hosting or operations setup. For example, the shape is:

ssh user@your-vps-host

The exact host name, port, key, and login account depend on your VPS. Use an account that can access the deployed application directory without changing ownership or permissions unnecessarily.

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

2. Change to the live project directory

Locate the directory that contains the live manage.py, then change into it:

cd /path/to/the/live/project

Check that the file is present before continuing:

ls manage.py

If several checkouts exist, identify the one referenced by the process manager or deployment configuration. Running a command in an old release directory is a common reason a password appears not to change.

3. Load the production Python environment

Activate the virtual environment used by the application, if your deployment uses one:

source /path/to/venv/bin/activate

Some deployments deliberately avoid activation. In that case, call the environment’s interpreter directly:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
/path/to/venv/bin/python manage.py changepassword <username>

Use the same environment variables and settings selection that the live process uses. If the project requires a settings variable, export it exactly as the deployment does before invoking manage.py. Otherwise Django may select a development settings module or connect to a different database.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

4. Run changepassword

With the environment loaded, run:

python manage.py changepassword <username>

Replace <username> with the existing account’s username. Django prompts for the replacement password twice. Type it at both prompts; terminal input is normally hidden. The password is changed only when the two entries match.

This command is available when the project has Django’s authentication application installed. It uses Django’s password machinery rather than storing the clear-text value. Django stores an encoded password hash on the user model, not the original password.

5. Select a non-default database when necessary

If the live user data is held in a configured database alias other than default, specify that alias:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
python manage.py changepassword <username> --database <alias>

For example, if the project defines an alias called primary:

python manage.py changepassword <username> --database primary

Without --database, Django uses the default alias. The alias must already exist in the project’s database configuration; the option does not create a connection or discover the production database automatically.

6. Test the actual admin endpoint

Open the admin URL used by the live site, not necessarily /admin/. Sign in with the exact username (or the project’s configured email-login identity) and the new password. If the site is behind a reverse proxy or load balancer, test the public hostname so that you exercise the same deployment path as administrators.

Choosing the right password-reset method

Situation Recommended method Why
You know the existing username and use the normal database python manage.py changepassword <username> Shortest supported interactive command; Django confirms the password twice and hashes it.
The project uses a custom user model or you identify the account by email Django shell with get_user_model() and set_password() Lets you query the configured model and choose a project-specific lookup.
The account is missing python manage.py createsuperuser Creates a new privileged account after prompting for its identity fields and password.
The project has multiple databases Add --database <alias> to the management command, or use the same alias in shell queries Ensures the operation targets the database used by the live site.

Do not create a second account simply because a password attempt failed. First establish which settings, database, user model, and account the running application uses.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Fallback: reset the password in the Django shell

Use the shell when you do not know the username, the project logs in with an email address, the user model is customized, or you need a controlled query before changing anything. Start it from the same live directory and Python environment:

python manage.py shell

Then load the configured user model rather than importing Django’s default model by assumption:

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"])

Change the lookup to match the project. It could use a username, an email address, an external identifier, or another field, but the query should identify exactly one intended account. A lookup that returns multiple records raises an error; a lookup that returns none does not change anything.

set_password() runs Django’s password-hashing workflow and places the encoded result on the object. Never assign a raw value directly:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
user.password = "plain-text-password"

That direct assignment would not perform the required hashing and can make the account unusable or expose a clear-text credential. Django’s authentication documentation specifically advises using helper methods such as set_password() instead of manipulating the password attribute directly.

Look up an account without exposing a real password

For an email-based lookup, the shell code can be split into a read step and a write step:

from django.contrib.auth import get_user_model

User = get_user_model()
user = User.objects.get(email="[email protected]")
print(user.pk, user.get_username(), user.is_active, user.is_staff)

Confirm the printed identity before changing it. Do not paste an actual production password into shell history, a ticket, deployment script, or source control. If your shell records commands, prefer an interactive approach that does not leave the credential in the history file, and follow your team’s cleanup policy afterward.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Using a particular database from the shell

For a non-default database, use the project’s configured alias on the queryset:

user = User.objects.using("primary").get(email="[email protected]")
user.set_password("use-a-new-unique-password")
user.save(using="primary", update_fields=["password"])

Use this only when primary is a real configured alias and is the database serving the live users. The alias in this example is illustrative; substitute the project’s actual name.

If the original account no longer exists

When no suitable privileged account exists, create one interactively:

python manage.py createsuperuser

Django prompts for the required identity fields and password, then creates a user with all permissions. The required fields depend on the project’s configured AUTH_USER_MODEL; a custom model may require an email address, a different identifier, or additional fields.

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

Run createsuperuser against the same settings and database as the live application. Creating a superuser in a development database or an unused release directory will not grant access to the public admin site. After signing in, follow the project’s account-management policy: remove or disable temporary credentials when they are no longer needed.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why the new password can still fail

The command changed a different database

This is the most important deployment check. Confirm the project directory, virtual environment, settings selection, environment variables, database host, and database alias. A local SQLite file, staging database, or old release can accept the change while production continues to use the old hash.

If the project defines multiple aliases, repeat the operation with the live alias using --database, or use .using("alias") in the shell. Verify the account’s identity and primary key in the same database before changing it.

The account is not eligible for admin access

A correct password does not override authorization checks. Inspect the intended account’s status in the configured user model. Many projects require an active account and staff permission for the admin site; some add their own permission or role checks. A superuser normally has all permissions, but a regular staff account may not.

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.

For a shell inspection, adapt this read-only check to the project:

print(user.get_username(), user.is_active, user.is_staff, user.is_superuser)

Do not change flags blindly. Establish the project’s access rules and alter only the account that should administer the site.

The site uses a custom login identity or URL

A custom user model may authenticate with email rather than a username. Use the identity expected by the login form and by the project’s authentication backend. Likewise, the admin interface may be mounted at a nonstandard path rather than /admin/. Check the deployed URL configuration and the link used by the application.

The running application has not followed the normal deployment reload

A password row is normally read from the database on authentication, but a deployment may include custom authentication code, cached user data, or a process-management workflow that requires a reload. Django does not define one universal VPS restart command. Use the project’s documented process-manager or deployment procedure; do not guess a service name or restart unrelated services.

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

Browser state or an old session is confusing the test

Test in a private browser window or clear cookies for the site, then sign in again. Password changes made through Django’s password-change mechanisms can invalidate existing sessions for the affected account according to the project’s authentication setup. A session that was already open may therefore stop working even though the new login is valid.

How Django stores and validates the new password

Django does not store raw, clear-text passwords on the user model. It stores an encoded hash that includes the information needed to verify a future login. That is why the correct operation is changepassword or set_password(), not a direct database update or assignment to the password field.

Password validators configured in AUTH_PASSWORD_VALIDATORS are applied by default by the changepassword and createsuperuser commands. A password that fails the project’s configured length, similarity, common-password, or numeric checks is rejected at the prompt. Validators do not automatically run whenever a model is saved, so code that calls set_password() should follow the project’s validation policy if it needs the same interactive checks.

The hash format and work factor are controlled by Django’s password-hasher configuration. You do not need to calculate a hash yourself, and manually copying one between databases is an unsafe substitute for changing the account through Django.

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

Operational and security precautions

  • Use a long, unique password that is not reused on the VPS, database, email account, or another service.
  • Keep the SSH terminal private while entering the password; prompts should not echo it, but screen recording and shell logging can still expose operational details.
  • Do not put a real password in a command-line argument, source file, deployment manifest, ticket, or chat message.
  • Review shell history and remove temporary credentials according to the VPS team’s shell and retention procedures. Cleanup commands differ between shells and operating policies.
  • Confirm that you changed the intended account and database before closing the SSH session.
  • Remove or disable a temporary superuser after recovering the original account, if your access policy permits.

A practical verification checklist

  1. From the deployment directory, confirm that manage.py belongs to the live release.
  2. Confirm that the Python interpreter and installed Django version are the ones used by the running application.
  3. Confirm the settings module and required environment variables.
  4. Identify the live database alias; use --database when it is not default.
  5. Verify the account with the configured user model, especially when login uses email.
  6. Run changepassword, or use set_password() in the shell when a custom lookup is required.
  7. Check the account’s active, staff, and project-specific authorization state.
  8. Sign in through the public admin URL in a fresh browser session.
  9. Use the deployment’s normal reload procedure only if that project requires it, and record any temporary-account cleanup.

Common mistakes and their corrections

Mistake What happens Correction
Running the command from a development checkout The development user or database changes, while production is unchanged. Locate the release directory and environment used by the live process.
Using the system Python instead of the project interpreter Django may be missing, a different version may load, or different settings may be selected. Activate the project virtual environment or call its Python path directly.
Omitting a non-default database alias The command uses default and may update the wrong user store. Pass --database <alias> and verify the alias configuration.
Assigning a plain string to user.password The value is not encoded through Django’s password hasher. Call user.set_password(...), then save the user.
Using a username for an email-based custom user model The lookup fails or targets the wrong identity. Call get_user_model() and query the field used by the project.
Creating a superuser in the wrong environment The new account exists only in staging or a local database. Run createsuperuser with production settings and the live database.
Testing the wrong URL or an old browser session A valid password appears not to work. Use the deployed admin path and test in a fresh session.

Bottom line

For an existing account, run python manage.py changepassword <username> from the live project with the live environment and database. Add --database <alias> when the user data is not in default. If you need a custom lookup, use get_user_model(), set_password(), and a targeted save in the Django shell. If no privileged account exists, use createsuperuser. When login still fails, investigate deployment context, account status, custom authentication rules, and the actual admin URL before changing the password again.

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 from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

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.