Recommendation System for Experiences in a city
Static files
python manage.py collectstatic --noinput
Reset Data
duplicate key value violates unique constraint in django
BEGIN;
SELECT setval(pg_get_serial_sequence('"auth_permission"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "auth_permission";
SELECT setval(pg_get_serial_sequence('"auth_group_permissions"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "auth_group_permissions";
SELECT setval(pg_get_serial_sequence('"auth_group"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "auth_group";
SELECT setval(pg_get_serial_sequence('"auth_user_groups"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "auth_user_groups";
SELECT setval(pg_get_serial_sequence('"auth_user_user_permissions"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "auth_user_user_permissions";
SELECT setval(pg_get_serial_sequence('"auth_user"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "auth_user";
SELECT setval(pg_get_serial_sequence('"polls_customer"','id'), coalesce(max("id"), 1), max("id") IS NOT null) FROM "polls_customer";
COMMIT;To insert csv in posgresql heroku
DATABASE=> \copy polls_question from places_tab.csv with(format csv, delimiter ' ', header true, encoding 'UTF-8');Manage migrations
heroku run python manage.py makemigrations
heroku run python manage.py migrate
heroku run python manage.py showmigrationsDownload a backup of the data
heroku pg:backups:capture --app <appname>
heroku pg:backups:download --app <appname>After doing this you can move your dump file to your local Postgre database with the following command.
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U postgres -d new latest.dumpAll in one (for windows only):
heroku pg:backups:capture --app t-buddy-placerecommender && heroku pg:backups:download --app t-buddy-placerecommender && pg_restore --verbose --clean --no-acl --no-owner -h localhost -U postgres -d new latest.dumpcommand to interact with psql
heroku pg:psql postgresql-fluffy-09392 --app t-buddy-placerecommenderCommand for requirements file
pip3 freeze > requirements.txtFocus only on the Model repository at the moment since the WebApp is focused soley on the development of the app, and it contains other programming languages than Python.
Get all the repository/forks in your local machine
$git clone <repository>Information about what changes have happened (In case you havent changed anything there wont appear any indications)
$git statusDo some changes in the repository IF you now run the previous status command you will be able to see that there is a file the needs to be commited
Before you commit, you need to add the changes Add a specific file:
$git add <file>Add all changes:
$git add .
Now you just have to commit
$git commit -m <Text that breifly states the main changes you made. All in ''>
Reached this point you will be able to push the changes to GiHub
$git push origin <your selected branch/ The default one is 'main'>
-
Click on the Fork button on the top right corner of the repository This will create a copy on your github profile from where you will be able to start making changes
-
Clone the repository
-
Either checkout to a new branch or use the default one main | master
-
Make the changes, add, commit and push
This will create a pull request which will then be evaluated by the main contributors of the repository and then if everything if fine and correct it will be merged to the original repo.
Errors: In case you are not able to push the changes add the following lines in the command line:
$git config --global --editand
[credential]
helper = osxkeychain
useHttpPath = trueTo see past versions of a specific file
$git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"$git hist
* fa3c141 2011-03-09 | Added HTML header (HEAD, master) [Alexander Shvets]
* 8c32287 2011-03-09 | Added standard HTML page tags [Alexander Shvets]
* 43628f7 2011-03-09 | Added h1 tag [Alexander Shvets]
* 911e8c9 2011-03-09 | First Commit [Alexander Shvets]$git checkout <hash>$cat hello.html$git checkout 911e8c9
Note: checking out '911e8c9'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 911e8c9... First Commit$cat hello.html
Hello, World!Get back to your default branch
$git checkout master


