Duration: 60 days = 12 weeks
Weekly Structure: 4 training days + 1 assessment/exercise day
Outcome: Production-ready Python developers with full-stack capabilities
- Change your database RDS instance security group to allow your machine to access it.
- Add your ip to the security group to acces the instance via Postgres.
- Make a copy of the database using pg_dump
$ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>- you will be asked for postgressql password.
- a dump file(.sql) will be created
- Restore that dump file to your local database.
- but you might need to drop the database and create it first
$ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
- the database is restored
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pytz | |
| from django.utils import timezone | |
| .... | |
| timezone.activate(pytz.timezone(user_time_zone)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # EMAIL Server config | |
| EMAIL_HOST = 'smtp.gmail.com' | |
| EMAIL_PORT = '587' | |
| EMAIL_HOST_USER = 'example@gmail.com' | |
| EMAIL_HOST_PASSWORD = 'somepassword' | |
| EMAIL_USE_TLS = True | |
| DEFAULT_FROM_EMAIL = 'example@gmail.com' | |
| EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib import admin | |
| from django.contrib.auth.models import Group | |
| from django.contrib.auth.admin import UserAdmin | |
| class UserProfileAdmin(UserAdmin): | |
| form = UserChangeForm | |
| add_form = UserCreationForm | |
| list_display = ('email', 'mobile', 'is_superuser') | |
| list_filter = ('is_superuser',) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BlockAdmin(NoLookupsForeignKeyAutocompleteAdmin, admin.ModelAdmin): | |
| … | |
| related_search_fields = { | |
| 'city' : ('name', 'state__name', ), | |
| } |