Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submissions for Assignment2 #7

Open
KenanBek opened this issue Apr 14, 2019 · 15 comments
Open

Submissions for Assignment2 #7

KenanBek opened this issue Apr 14, 2019 · 15 comments
Assignees

Comments

@KenanBek
Copy link
Member

KenanBek commented Apr 14, 2019

This assignment is based on DevHub. Please check repository before starting with this assignment.

As a task, you need to implement basic functionality for Django 2 project. Video describing all the details:

Video explaining Assignment2

Shortly,

  1. you need to fork this repository
  2. then in assignments/assignment2/solutions create a new folder associated with your username. Example: assignments/assignment2/solutions/kenanbek
  3. as a base version copy assignments/assignment2/devhub-0.1.0 to this directory
  4. start with the implementation of the following tasks

Tasks for Assignment2:

  1. Introduce Django backend and frontend (separate from React frontend)
  2. Introduce database model classes
  3. User register model (via Django frontend)
  4. User login model (via Django frontend)
  5. Setup Docker environment for Django project with Postgres database

In the example folder (assignments/assignment2/solutions/kenanbek) you can find a solution for the first task. Video explaining the solution:

Exact steps to start with the assignment:

cd assignments/assignment2
cp -R devhub-0.1.0 solutions/<YOUR-GITHUB-USERNAME>
cd solutions/<YOUR-GITHUB-USERNAME>
virtualenv venv -p python3
source ./venv/bin/activate
python src/manage.py makemigrations
python src/manage.py migrate
python src/manage.py runserver

These tutorials can be helpful:

  1. Django Web Framework: How to Setup Django 2.1 and Python 3 Example Project Structure with GitHub
  2. Introduction & Custom User Model
  3. Setup URLs, templates and HTML views for Account application
@KenanBek KenanBek self-assigned this Apr 16, 2019
@KenanBek KenanBek changed the title Submissions for Assignment #2 Submissions for Assignment2 Apr 16, 2019
@Nkarnaud
Copy link

Hi,
am having the following error after cloning and running the DevHub app.

Unhandled exception in thread started by <function check_errors..wrapper at 0x7fae1798a620>
Traceback (most recent call last):
File "/home/nkeumo/Dev/Django/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/nkeumo/Dev/Django/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/home/nkeumo/Dev/Django/lib/python3.6/site-packages/django/utils/autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "/home/nkeumo/Dev/Django/lib/python3.6/site-packages/django/core/management/init.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "/home/nkeumo/Dev/Django/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/nkeumo/Dev/Django/lib/python3.6/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/nkeumo/Dev/Django/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
app_config = AppConfig.create(entry)
File "/home/nkeumo/Dev/Django/lib/python3.6/site-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/home/nkeumo/Dev/Django/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'account.app'

@KenanBek
Copy link
Member Author

@Nkarnaud could you please provide the actions you take to run the app? Do you set src as source root?

@Nkarnaud
Copy link

Nkarnaud commented Apr 19, 2019

Yes the src is my root directory and i run with this command python manage.py runserver

@Nkarnaud
Copy link

To solve the issue i have to clone the project from

**CoderVlogger/devhub** and copy it in my project on python mentorship

@KenanBek
Copy link
Member Author

@Nkarnaud no, you can use the version which is in assignments/assignment2/devhub-0.1.0.

@KenanBek
Copy link
Member Author

KenanBek commented Apr 19, 2019

Steps to start with the assignment:

cd assignments/assignment2
cp -R devhub-0.1.0 solutions/<YOUR-GITHUB-USERNAME>
cd solutions/<YOUR-GITHUB-USERNAME>
virtualenv venv -p python3
source ./venv/bin/activate
python src/manage.py runserver

@Nkarnaud
Copy link

@KenanBek I use that but it is giving me the above error. i will check on that again

@KenanBek
Copy link
Member Author

@Nkarnaud I found error. In src/devhub/settings change this account.app.AccountConfig to this account.apps.AccountConfig.

@Nkarnaud
Copy link

okay thanks for your feedback

@KenanBek
Copy link
Member Author

@Nkarnaud and also in src/account/models.py change this REQUIRED_FIELDS = ['username', 'email'] to REQUIRED_FIELDS = ['email'].

@Nkarnaud
Copy link

i have already done that

@KenanBek
Copy link
Member Author

@Nkarnaud and before runserver run:

python manage.py makemigrations
python manage.py migrate

Let me know if you can run app now.

@Nkarnaud
Copy link

the app is running now

@KenanBek
Copy link
Member Author

I have updated the source code with the fixes in assignments/assignment2/devhub-0.1.0.

@Nkarnaud
Copy link

the app is running now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants