Skip to content

Commit

Permalink
Merge pull request #123 from matorral-project/more-hatch-commands-ins…
Browse files Browse the repository at this point in the history
…tallation

Making the installation & initial setup process easier
  • Loading branch information
matagus authored Mar 8, 2024
2 parents 0e9b2c8 + d870983 commit 483175e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 10 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,22 @@ pip install hatch

or see [instructions for alternative methods](https://hatch.pypa.io/latest/install/).

3. Run migrations:
3. Run the install command:

```
hatch run local:migrate
hatch run local:install
```

4. Run the server:
This will create the database, run the migrations, setup the `config/.env` configuration file and create a superuser/.
You will be asked a username, email and password for the superuser at the end of the process.

4. Run the web server:

```
hatch run local:server
```

5. Open your browser at `http://localhost:8000`
5. Open your browser at [http://localhost:8000](http://localhost:8000) and login using the user credentials you created in step 3.


### Run Tests
Expand Down
1 change: 0 additions & 1 deletion config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# User management
re_path(r"^users/", include("matorral.users.urls")),
# App
path(r"<workspace>/workspaces/", include("matorral.workspaces.urls", namespace="workspaces")),
path(r"<workspace>/", include("matorral.stories.urls", namespace="stories")),
path(r"<workspace>/sprints/", include("matorral.sprints.urls", namespace="sprints")),
path(r"", workspace_index, name="workspace:index"), # disabled for now, until we finish all the features
Expand Down
5 changes: 0 additions & 5 deletions matorral/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ <h1 class="title has-text-white-bis">
Admin
</a>
{% endif %}
{% if current_workspace %}
<a class="navbar-item" href="{% url 'workspaces:workspace-list' current_workspace %}">
Workspaces
</a>
{% endif %}
<form method="post" action="{% url 'logout' %}" class="navbar-item">
{% csrf_token %}
<button class="button" type="submit" onclick="event.preventDefault(); this.form.submit();">
Expand Down
7 changes: 7 additions & 0 deletions matorral/workspaces/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
from django.apps import AppConfig
from django.db.models.signals import post_save


class WorkspacesConfig(AppConfig):
name = "matorral.workspaces"

def ready(self):
from matorral.workspaces import signals
from matorral.users.models import User

post_save.connect(signals.create_default_workspace, sender=User)
9 changes: 9 additions & 0 deletions matorral/workspaces/signals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from matorral.workspaces.models import Workspace


def create_default_workspace(*args, **kwargs):
user = kwargs["instance"]

if kwargs["created"] and Workspace.objects.count() == 0:
workspace = Workspace.objects.create(name="Default Workspace", slug="default", owner=user)
workspace.members.add(user)
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ server = "python manage.py runserver_plus {args}"
shell = "python manage.py shell_plus {args}"
migrate = "python manage.py migrate {args}"
makemigrations = "python manage.py makemigrations {args}"
createuser = "python manage.py createsuperuser {args}"
copy-config = "cp config/env.example config/.env"
install = ["migrate", "copy-config", "createuser"]

# Production environment
[tool.hatch.envs.prod]
Expand Down

0 comments on commit 483175e

Please sign in to comment.